Versioning and Ansible-Linting fixes are introduced to wazuh-agent and filebeat installations and testings
This commit is contained in:
parent
5d006cbc3a
commit
873e9759ae
@ -5,6 +5,9 @@ driver:
|
|||||||
name: docker
|
name: docker
|
||||||
lint:
|
lint:
|
||||||
name: yamllint
|
name: yamllint
|
||||||
|
options:
|
||||||
|
config-data:
|
||||||
|
ignore: .virtualenv
|
||||||
platforms:
|
platforms:
|
||||||
- name: trusty
|
- name: trusty
|
||||||
image: ubuntu:trusty
|
image: ubuntu:trusty
|
||||||
|
|||||||
@ -4,3 +4,10 @@ import testinfra.utils.ansible_runner
|
|||||||
|
|
||||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||||
|
|
||||||
|
|
||||||
|
def test_filebeat_is_installed(host):
|
||||||
|
"""Test if the elasticsearch package is installed."""
|
||||||
|
filebeat = host.package("filebeat")
|
||||||
|
assert filebeat.is_installed
|
||||||
|
assert filebeat.version.startswith('7.1.1')
|
||||||
|
|||||||
@ -7,6 +7,11 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|||||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('agent')
|
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('agent')
|
||||||
|
|
||||||
|
|
||||||
|
def get_wazuh_version():
|
||||||
|
"""This return the version of Wazuh."""
|
||||||
|
return "3.9.0"
|
||||||
|
|
||||||
|
|
||||||
def test_ossec_package_installed(Package):
|
def test_ossec_package_installed(Package):
|
||||||
ossec = Package('wazuh-agent')
|
ossec = Package('wazuh-agent')
|
||||||
assert ossec.is_installed
|
assert ossec.is_installed
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
filebeat_version: 7.1.1
|
||||||
|
|
||||||
filebeat_create_config: true
|
filebeat_create_config: true
|
||||||
|
|
||||||
filebeat_prospectors:
|
filebeat_prospectors:
|
||||||
|
|||||||
@ -5,13 +5,27 @@
|
|||||||
- import_tasks: Debian.yml
|
- import_tasks: Debian.yml
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
- name: Install Filebeat.
|
- name: CentOS/RedHat | Install Filebeat.
|
||||||
package: name=filebeat state=present
|
package: name=filebeat-{{ filebeat_version }} state=present
|
||||||
register: filebeat_installing_package
|
register: filebeat_installing_package
|
||||||
until: filebeat_installing_package is succeeded
|
until: filebeat_installing_package is succeeded
|
||||||
|
when:
|
||||||
|
- ansible_distribution in ['CentOS','RedHat']
|
||||||
tags:
|
tags:
|
||||||
- install
|
- install
|
||||||
|
|
||||||
|
- name: Debian/Ubuntu | Install Filebeat.
|
||||||
|
apt:
|
||||||
|
name: filebeat={{ filebeat_version }}
|
||||||
|
state: present
|
||||||
|
cache_valid_time: 3600
|
||||||
|
register: filebeat_installing_package_debian
|
||||||
|
until: filebeat_installing_package_debian is succeeded
|
||||||
|
when:
|
||||||
|
- not (ansible_distribution in ['CentOS','RedHat'])
|
||||||
|
tags:
|
||||||
|
- init
|
||||||
|
|
||||||
- name: Check if certificate exists locally
|
- name: Check if certificate exists locally
|
||||||
stat:
|
stat:
|
||||||
path: "{{ node_certs_destination }}/{{ filebeat_node_name }}.crt"
|
path: "{{ node_certs_destination }}/{{ filebeat_node_name }}.crt"
|
||||||
@ -43,7 +57,9 @@
|
|||||||
tags: xpack-security
|
tags: xpack-security
|
||||||
|
|
||||||
- name: Importing key & certificate files from generator node
|
- name: Importing key & certificate files from generator node
|
||||||
shell: "{{rsync_path}} {{rsync_extra_parameters}} {{rsync_user}}@{{node_certs_generator_ip}}:{{node_certs_source}}/{{filebeat_node_name}}/ {{node_certs_destination}}/"
|
command: >-
|
||||||
|
{{ rsync_path }} {{ rsync_extra_parameters }} {{ rsync_user }}@{{ node_certs_generator_ip }}:
|
||||||
|
{{ node_certs_source }}/{{ filebeat_node_name }}/ {{ node_certs_destination }}/
|
||||||
when:
|
when:
|
||||||
- not node_certs_generator
|
- not node_certs_generator
|
||||||
- filebeat_xpack_security
|
- filebeat_xpack_security
|
||||||
@ -51,7 +67,9 @@
|
|||||||
tags: xpack-security
|
tags: xpack-security
|
||||||
|
|
||||||
- name: Importing ca certificate file from generator node
|
- name: Importing ca certificate file from generator node
|
||||||
shell: "{{rsync_path}} {{rsync_extra_parameters}} {{rsync_user}}@{{node_certs_generator_ip}}:{{node_certs_source}}/ca/ {{node_certs_destination}}/"
|
command: >-
|
||||||
|
{{ rsync_path }} {{ rsync_extra_parameters }} {{ rsync_user }}@{{ node_certs_generator_ip }}:
|
||||||
|
{{ node_certs_source }}/ca/ {{ node_certs_destination }}/
|
||||||
when:
|
when:
|
||||||
- not node_certs_generator
|
- not node_certs_generator
|
||||||
- filebeat_xpack_security
|
- filebeat_xpack_security
|
||||||
@ -60,7 +78,11 @@
|
|||||||
tags: xpack-security
|
tags: xpack-security
|
||||||
|
|
||||||
- name: Ensuring certificates folder owner
|
- name: Ensuring certificates folder owner
|
||||||
shell: "chmod -R 770 {{node_certs_destination}}/"
|
file:
|
||||||
|
path: "{{ node_certs_destination }}/"
|
||||||
|
mode: '0770'
|
||||||
|
recurse: yes
|
||||||
|
|
||||||
when:
|
when:
|
||||||
- check_certs_permissions is defined
|
- check_certs_permissions is defined
|
||||||
- filebeat_xpack_security
|
- filebeat_xpack_security
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
wazuh_agent_version: 3.9.0
|
||||||
wazuh_managers:
|
wazuh_managers:
|
||||||
- address: 127.0.0.1
|
- address: 127.0.0.1
|
||||||
port: 1514
|
port: 1514
|
||||||
@ -23,10 +24,10 @@ wazuh_winagent_config:
|
|||||||
install_dir_x86: 'C:\Program Files (x86)\ossec-agent\'
|
install_dir_x86: 'C:\Program Files (x86)\ossec-agent\'
|
||||||
auth_path: C:\'Program Files'\ossec-agent\agent-auth.exe
|
auth_path: C:\'Program Files'\ossec-agent\agent-auth.exe
|
||||||
auth_path_x86: C:\'Program Files (x86)'\ossec-agent\agent-auth.exe
|
auth_path_x86: C:\'Program Files (x86)'\ossec-agent\agent-auth.exe
|
||||||
version: '3.9.2'
|
version: '3.9.3'
|
||||||
revision: '1'
|
revision: '1'
|
||||||
repo: https://packages.wazuh.com/3.x/windows/
|
repo: https://packages.wazuh.com/3.x/windows/
|
||||||
md5: 43936e7bc7eb51bd186f47dac4a6f477
|
md5: c3fdbd6c121ca371b8abcd477ed4e8a4
|
||||||
wazuh_agent_config:
|
wazuh_agent_config:
|
||||||
active_response:
|
active_response:
|
||||||
ar_disabled: 'no'
|
ar_disabled: 'no'
|
||||||
|
|||||||
@ -5,10 +5,22 @@
|
|||||||
- import_tasks: "Debian.yml"
|
- import_tasks: "Debian.yml"
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_os_family == "Debian"
|
||||||
|
|
||||||
- name: Linux | Install wazuh-agent
|
- name: Linux CentOS/RedHat | Install wazuh-agent
|
||||||
package: name=wazuh-agent state=present
|
package: name=wazuh-agent-{{ wazuh_agent_version }}-1 state=present
|
||||||
async: 90
|
async: 90
|
||||||
poll: 30
|
poll: 30
|
||||||
|
when:
|
||||||
|
- ansible_distribution in ['CentOS','RedHat']
|
||||||
|
tags:
|
||||||
|
- init
|
||||||
|
|
||||||
|
- name: Linux Debian | Install wazuh-agent
|
||||||
|
apt:
|
||||||
|
name: "wazuh-agent={{ wazuh_agent_version }}-1"
|
||||||
|
state: present
|
||||||
|
cache_valid_time: 3600
|
||||||
|
when:
|
||||||
|
- not (ansible_distribution in ['CentOS','RedHat'])
|
||||||
tags:
|
tags:
|
||||||
- init
|
- init
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
- import_tasks: "Debian.yml"
|
- import_tasks: "Debian.yml"
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_os_family == "Debian"
|
||||||
|
|
||||||
- name: CentOS/RedHat | Install wazuh-manager, wazuh-api and expect
|
- name: CentOS/RedHat | Install wazuh-manager, wazuh-api
|
||||||
package: pkg={{ item }}-{{ wazuh_manager_api_version }}-1 state={{ wazuh_manager_package_state }}
|
package: pkg={{ item }}-{{ wazuh_manager_api_version }}-1 state={{ wazuh_manager_package_state }}
|
||||||
with_items:
|
with_items:
|
||||||
- wazuh-manager
|
- wazuh-manager
|
||||||
@ -17,7 +17,7 @@
|
|||||||
tags:
|
tags:
|
||||||
- init
|
- init
|
||||||
|
|
||||||
- name: Debian/Ubuntu | Install wazuh-manager, wazuh-api and expect
|
- name: Debian/Ubuntu | Install wazuh-manager, wazuh-api
|
||||||
apt:
|
apt:
|
||||||
name: "{{ item }}={{ wazuh_manager_api_version }}-1"
|
name: "{{ item }}={{ wazuh_manager_api_version }}-1"
|
||||||
state: present
|
state: present
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user