Skip to content

Commit

Permalink
fix(#2796): fix indexer role in 4.4
Browse files Browse the repository at this point in the history
4.4 changes:
- Plugin conf path has changed
- The task that initializes the Opensearch security index does not work
  • Loading branch information
Luis Gonzalez authored and Rebits committed Sep 5, 2022
1 parent 0923902 commit 988236e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion roles/wazuh/wazuh-indexer/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ minimum_master_nodes: 2
# Example es1.example.com, es2.example.com
domain_name: wazuh.com

indexer_sec_plugin_conf_path: /usr/share/wazuh-indexer/plugins/opensearch-security/securityconfig
indexer_sec_plugin_conf_path: /etc/wazuh-indexer/opensearch-security
indexer_sec_plugin_tools_path: /usr/share/wazuh-indexer/plugins/opensearch-security/tools
indexer_conf_path: /etc/wazuh-indexer/
indexer_index_path: /var/lib/wazuh-indexer/
Expand Down
12 changes: 5 additions & 7 deletions roles/wazuh/wazuh-indexer/tasks/security_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,38 +52,38 @@
{{ indexer_sec_plugin_tools_path }}/hash.sh -p {{ indexer_admin_password }}
register: indexer_admin_password_hashed
no_log: '{{ indexer_nolog_sensible | bool }}'

- name: Set the Admin user password
replace:
path: "{{ indexer_sec_plugin_conf_path }}/internal_users.yml"
regexp: '(?<=admin:\n hash: )(.*)(?=)'
replace: "{{ indexer_password_hash | quote }}"
vars:
indexer_password_hash: "{{ indexer_admin_password_hashed.stdout_lines | last }}"

# this can also be achieved with password_hash, but it requires dependencies on the controller
- name: Hash the kibanaserver role/user pasword
shell: |
export JAVA_HOME=/usr/share/wazuh-indexer/jdk
{{ indexer_sec_plugin_tools_path }}/hash.sh -p {{ dashboard_password }}
register: indexer_kibanaserver_password_hashed
no_log: '{{ indexer_nolog_sensible | bool }}'

- name: Set the kibanaserver user password
replace:
path: "{{ indexer_sec_plugin_conf_path }}/internal_users.yml"
regexp: '(?<=kibanaserver:\n hash: )(.*)(?=)'
replace: "{{ indexer_password_hash | quote }}"
vars:
indexer_password_hash: "{{ indexer_kibanaserver_password_hashed.stdout_lines | last }}"

- name: Initialize the Opensearch security index in Wazuh indexer
command: >
sudo -u wazuh-indexer OPENSEARCH_PATH_CONF={{ indexer_conf_path }}
JAVA_HOME=/usr/share/wazuh-indexer/jdk
{{ indexer_sec_plugin_tools_path }}/securityadmin.sh
-cd {{ indexer_sec_plugin_conf_path }}/
-icl -p 9300 -cd {{ indexer_sec_plugin_conf_path }}/
-icl -p {{indexer_http_port}} -cd {{ indexer_sec_plugin_conf_path }}/
-nhnv
-cacert {{ indexer_conf_path }}/certs/root-ca.pem
-cert {{ indexer_conf_path }}/certs/admin.pem
Expand Down Expand Up @@ -114,5 +114,3 @@
timeout: 4
when:
- indexer_custom_user is defined and indexer_custom_user


0 comments on commit 988236e

Please sign in to comment.