Merge pull request #406 from pchristos/wazuh-agent-fixes

Fixes for wazuh-agent registration
This commit is contained in:
Manuel J. Bernal 2020-06-19 19:00:03 +02:00 committed by GitHub
commit 03ba9c0a0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,17 +50,25 @@
- name: Retrieving authd Credentials - name: Retrieving authd Credentials
include_vars: authd_pass.yml include_vars: authd_pass.yml
- name: Copy CA, SSL key and cert for authd - name: Copy CA root certificate to verify authd
copy:
src: "{{ wazuh_agent_authd.ssl_agent_ca }}"
dest: "/var/ossec/etc/{{ wazuh_agent_authd.ssl_agent_ca | basename }}"
mode: 0644
when:
- wazuh_agent_authd.ssl_agent_ca is not none
- name: Copy TLS/SSL certificate for agent verification
copy: copy:
src: "{{ item }}" src: "{{ item }}"
dest: "/var/ossec/etc/{{ item | basename }}" dest: "/var/ossec/etc/{{ item | basename }}"
mode: 0644 mode: 0644
with_items: with_items:
- "{{ wazuh_agent_authd.ssl_agent_ca }}"
- "{{ wazuh_agent_authd.ssl_agent_cert }}" - "{{ wazuh_agent_authd.ssl_agent_cert }}"
- "{{ wazuh_agent_authd.ssl_agent_key }}" - "{{ wazuh_agent_authd.ssl_agent_key }}"
when: when:
- wazuh_agent_authd.ssl_agent_ca is not none - wazuh_agent_authd.ssl_agent_cert is not none
- wazuh_agent_authd.ssl_agent_key is not none
- name: Linux | Register agent (via authd) - name: Linux | Register agent (via authd)
shell: > shell: >
@ -133,7 +141,7 @@
- config - config
- api - api
- name: Linux | Retieve new agent data via rest-API - name: Linux | Retrieve new agent data via rest-API
uri: uri:
url: >- url: >-
"{{ wazuh_managers.0.api_proto }}://{{ wazuh_agent_authd.registration_address "{{ wazuh_managers.0.api_proto }}://{{ wazuh_agent_authd.registration_address
@ -167,7 +175,7 @@
when: when:
- not check_keys.stat.exists or check_keys.stat.size == 0 - not check_keys.stat.exists or check_keys.stat.size == 0
- wazuh_agent_authd.registration_address is not none - wazuh_agent_authd.registration_address is not none
- newagent_api.changed - newagent_api.json.error == 0
notify: restart wazuh-agent notify: restart wazuh-agent
when: when: