roles/wazuh-agent: Fix authd registration verify task. Use authd pass only if size > 0
This commit is contained in:
parent
ed7b24ff96
commit
ff78ce7d76
@ -47,7 +47,7 @@
|
||||
- name: Linux | Check if client.keys exists
|
||||
stat: path=/var/ossec/etc/client.keys
|
||||
register: check_keys
|
||||
when: wazuh_agent_config.enrollment.enabled == 'yes'
|
||||
when: wazuh_agent_config.enrollment.enabled == 'no'
|
||||
tags:
|
||||
- config
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
-m {{ wazuh_agent_authd.registration_address }}
|
||||
-p {{ wazuh_agent_authd.port }}
|
||||
{% if wazuh_agent_nat %} -I "any" {% endif %}
|
||||
{% if authd_pass is defined %} -P {{ authd_pass }} {% endif %}
|
||||
{% if authd_pass is defined and authd_pass | length > 0 %} -P {{ authd_pass }} {% endif %}
|
||||
{% if wazuh_agent_authd.ssl_agent_ca is defined and wazuh_agent_authd.ssl_agent_ca != None %}
|
||||
-v "/var/ossec/etc/{{ wazuh_agent_authd.ssl_agent_ca | basename }}"
|
||||
{% endif %}
|
||||
@ -109,7 +109,7 @@
|
||||
- wazuh_agent_authd.registration_address is not none
|
||||
|
||||
- name: Linux | Verify agent registration
|
||||
shell: echo {{ agent_auth_output }} | grep "Valid key created"
|
||||
shell: echo {{ agent_auth_output }} | grep "Valid key received"
|
||||
when:
|
||||
- not check_keys.stat.exists or check_keys.stat.size == 0
|
||||
- wazuh_agent_authd.registration_address is not none
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
-m {{ wazuh_agent_authd.registration_address }}
|
||||
-p {{ wazuh_agent_authd.port }}
|
||||
{% if wazuh_agent_authd.agent_name is not none %}-A {{ wazuh_agent_authd.agent_name }} {% endif %}
|
||||
{% if authd_pass is defined %} -P {{ authd_pass }}{% endif %}
|
||||
{% if authd_pass is defined and authd_pass | length > 0 %} -P {{ authd_pass }}{% endif %}
|
||||
register: agent_auth_output
|
||||
notify: Windows | Restart Wazuh Agent
|
||||
when:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user