Skip to content

Commit

Permalink
refactor(#3863): improve test_assign_groups_guess
Browse files Browse the repository at this point in the history
* refactor(#3863): check expected logs

* feat(#3863): update changelog

* feat(#3863): add messages

* fix(#3863): fix linter errors

* fix(#3863): fix linter errors
  • Loading branch information
juliamagan authored and Deblintrake09 committed Apr 24, 2023
1 parent 565c9e0 commit e634e8d
Show file tree
Hide file tree
Showing 12 changed files with 150 additions and 120 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Release report: TBD

### Changed

- Improve `test_assign_groups_guess` ([#3901](https:/wazuh/wazuh-qa/pull/3901)) \- (Tests)
- Update `test_cluster_worker_logs_order` test ([#3896](https:/wazuh/wazuh-qa/pull/3896)) \- (Tests)
- Fix `test_agent_groups` ([#3889](https:/wazuh/wazuh-qa/pull/3889)) \- (Tests + Framework)
- Increase NVE download feed test timeout([#3769](https:/wazuh/wazuh-qa/pull/3769)) \- (Tests)
Expand Down
27 changes: 13 additions & 14 deletions tests/system/provisioning/enrollment_cluster/playbook.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
- name: Create our container (Master)
hosts: localhost
vars_files:
- ./vars/configurations.yml
- ./vars/configurations.yaml
tasks:
- name: Create a network
docker_network:
Expand All @@ -17,7 +16,7 @@
- name: Create our container (Worker1)
hosts: localhost
vars_files:
- ./vars/configurations.yml
- ./vars/configurations.yaml
tasks:
- docker_container:
name: "{{ worker1_hostname }}"
Expand All @@ -29,7 +28,7 @@
- name: Create our container (Worker2)
hosts: localhost
vars_files:
- ./vars/configurations.yml
- ./vars/configurations.yaml
tasks:
- docker_container:
name: "{{ worker2_hostname }}"
Expand All @@ -41,7 +40,7 @@
- name: Create our container (Agent1)
hosts: localhost
vars_files:
- ./vars/configurations.yml
- ./vars/configurations.yaml
tasks:
- docker_container:
name: "{{ agent1_hostname }}"
Expand All @@ -53,36 +52,36 @@
- name: Wazuh Master
hosts: wazuh-master
vars:
master_hostname: "wazuh-master"
master_hostname: wazuh-master
vars_files:
- ./vars/configurations.yml
- ./vars/configurations.yaml
roles:
- name: "roles/master-role"
- name: roles/master-role

- name: Wazuh Worker1
hosts: wazuh-worker1
vars:
worker_name: wazuh-worker1
vars_files:
- ./vars/configurations.yml
- ./vars/configurations.yaml
roles:
- name: "roles/worker-role"
- name: roles/worker-role

- name: Wazuh Worker2
hosts: wazuh-worker2
vars:
worker_name: wazuh-worker2
vars_files:
- ./vars/configurations.yml
- ./vars/configurations.yaml
roles:
- name: "roles/worker-role"
- name: roles/worker-role

- name: Wazuh Agent1
hosts: wazuh-agent1
vars:
manager_hostname: wazuh-master
agent_hostname: "{{ agent1_hostname }}"
vars_files:
- ./vars/configurations.yml
- ./vars/configurations.yaml
roles:
- name: "roles/agent-role"
- name: roles/agent-role
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
- name: "Check and update debian repositories"
- name: Check and update debian repositories
shell:
cmd: apt-get update --allow-releaseinfo-change

- name: "Installing dependencies using apt"
- name: Installing dependencies using apt
apt:
pkg:
- git
Expand All @@ -18,14 +17,14 @@
- libtool
- python3-pytest
- libssl-dev
force_apt_get: yes
force_apt_get: true
state: present
update_cache: yes
update_cache: true
cache_valid_time: 3600

- name: "Clone wazuh repository"
- name: Clone wazuh repository
git:
repo: "https:/wazuh/wazuh"
repo: https:/wazuh/wazuh
dest: /wazuh
version: "{{ wazuh_branch }}"

Expand All @@ -34,19 +33,19 @@
chdir: /wazuh
creates: /var/ossec
environment:
USER_LANGUAGE: "en"
USER_NO_STOP: "y"
USER_INSTALL_TYPE: "agent"
USER_DIR: "/var/ossec"
USER_ENABLE_EMAIL: "n"
USER_ENABLE_SYSCHECK: "y"
USER_ENABLE_ROOTCHECK: "y"
USER_ENABLE_OPENSCAP: "y"
USER_WHITE_LIST: "n"
USER_ENABLE_SYSLOG: "y"
USER_ENABLE_AUTHD: "y"
USER_AUTO_START: "y"
shell: "./install.sh"
USER_LANGUAGE: en
USER_NO_STOP: y
USER_INSTALL_TYPE: agent
USER_DIR: /var/ossec
USER_ENABLE_EMAIL: n
USER_ENABLE_SYSCHECK: y
USER_ENABLE_ROOTCHECK: y
USER_ENABLE_OPENSCAP: y
USER_WHITE_LIST: n
USER_ENABLE_SYSLOG: y
USER_ENABLE_AUTHD: y
USER_AUTO_START: y
shell: ./install.sh

- name: Copy ossec.conf file
copy:
Expand All @@ -64,9 +63,9 @@
- name: Set Wazuh Manager IP
lineinfile:
path: /var/ossec/etc/ossec.conf
regexp: '<address>(.*)</address>'
line: "<address>{{ worker1_hostname }}</address>"
backrefs: yes
regexp: <address>(.*)</address>
line: <address>{{ worker1_hostname }}</address>
backrefs: true

- name: enable agentd debug mode
blockinfile:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
- name: "Check and update debian repositories"
- name: Check and update debian repositories
shell:
cmd: apt-get update --allow-releaseinfo-change

- name: "Installing dependencies using apt"
- name: Installing dependencies using apt
apt:
pkg:
- git
Expand All @@ -17,14 +16,14 @@
- autoconf
- libtool
- libssl-dev
force_apt_get: yes
force_apt_get: true
state: present
update_cache: yes
update_cache: true
cache_valid_time: 3600

- name: "Clone wazuh repository"
- name: Clone wazuh repository
git:
repo: "https:/wazuh/wazuh"
repo: https:/wazuh/wazuh
dest: /wazuh
version: "{{ wazuh_branch }}"

Expand All @@ -33,20 +32,20 @@
chdir: /wazuh
creates: /var/ossec
environment:
USER_LANGUAGE: "en"
USER_NO_STOP: "y"
USER_INSTALL_TYPE: "server"
USER_DIR: "/var/ossec"
USER_ENABLE_EMAIL: "n"
USER_ENABLE_SYSCHECK: "n"
USER_ENABLE_ROOTCHECK: "n"
USER_ENABLE_OPENSCAP: "n"
USER_WHITE_LIST: "n"
USER_ENABLE_SYSLOG: "y"
USER_ENABLE_AUTHD: "y"
USER_AUTO_START: "y"
USER_UPDATE: "n"
shell: "./install.sh"
USER_LANGUAGE: en
USER_NO_STOP: y
USER_INSTALL_TYPE: server
USER_DIR: /var/ossec
USER_ENABLE_EMAIL: n
USER_ENABLE_SYSCHECK: n
USER_ENABLE_ROOTCHECK: n
USER_ENABLE_OPENSCAP: n
USER_WHITE_LIST: n
USER_ENABLE_SYSLOG: y
USER_ENABLE_AUTHD: y
USER_AUTO_START: y
USER_UPDATE: n
shell: ./install.sh

- name: Copy ossec.conf file
copy:
Expand All @@ -59,16 +58,16 @@
- name: Set cluster key
lineinfile:
path: /var/ossec/etc/ossec.conf
regexp: '<key>(KEY)</key>'
line: "<key>{{ cluster_key }}</key>"
backrefs: yes
regexp: <key>(KEY)</key>
line: <key>{{ cluster_key }}</key>
backrefs: true

- name: Set Wazuh Master IP
lineinfile:
path: /var/ossec/etc/ossec.conf
regexp: '<node>(.*)</node>'
line: "<node>{{ master_hostname }}</node>"
backrefs: yes
regexp: <node>(.*)</node>
line: <node>{{ master_hostname }}</node>
backrefs: true

- name: Stop Wazuh
command: /var/ossec/bin/wazuh-control stop
Expand All @@ -84,6 +83,7 @@
block: |
authd.debug=2
wazuh_clusterd.debug=2
remoted.debug=2
- name: Start Wazuh
command: /var/ossec/bin/wazuh-control restart
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
- name: "Check and update debian repositories"
- name: Check and update debian repositories
shell:
cmd: apt-get update --allow-releaseinfo-change

- name: "Installing dependencies using apt"
- name: Installing dependencies using apt
apt:
pkg:
- git
Expand All @@ -18,14 +17,14 @@
- libtool
- python3-pytest
- libssl-dev
force_apt_get: yes
force_apt_get: true
state: present
update_cache: yes
update_cache: true
cache_valid_time: 3600

- name: "Clone wazuh repository"
- name: Clone wazuh repository
git:
repo: "https:/wazuh/wazuh"
repo: https:/wazuh/wazuh
dest: /wazuh
version: "{{ wazuh_branch }}"

Expand All @@ -34,20 +33,20 @@
chdir: /wazuh
creates: /var/ossec
environment:
USER_LANGUAGE: "en"
USER_NO_STOP: "y"
USER_INSTALL_TYPE: "server"
USER_DIR: "/var/ossec"
USER_ENABLE_EMAIL: "n"
USER_ENABLE_SYSCHECK: "y"
USER_ENABLE_ROOTCHECK: "y"
USER_ENABLE_OPENSCAP: "y"
USER_WHITE_LIST: "n"
USER_ENABLE_SYSLOG: "y"
USER_ENABLE_AUTHD: "y"
USER_AUTO_START: "y"
USER_UPDATE: "n"
shell: "./install.sh"
USER_LANGUAGE: en
USER_NO_STOP: y
USER_INSTALL_TYPE: server
USER_DIR: /var/ossec
USER_ENABLE_EMAIL: n
USER_ENABLE_SYSCHECK: y
USER_ENABLE_ROOTCHECK: y
USER_ENABLE_OPENSCAP: y
USER_WHITE_LIST: n
USER_ENABLE_SYSLOG: y
USER_ENABLE_AUTHD: y
USER_AUTO_START: y
USER_UPDATE: n
shell: ./install.sh

- name: Copy ossec.conf file
copy:
Expand All @@ -60,30 +59,31 @@
- name: Set cluster key
lineinfile:
path: /var/ossec/etc/ossec.conf
regexp: '<key>(KEY)</key>'
line: "<key>{{ cluster_key }}</key>"
backrefs: yes
regexp: <key>(KEY)</key>
line: <key>{{ cluster_key }}</key>
backrefs: true

- name: Set Wazuh Worker name
lineinfile:
path: /var/ossec/etc/ossec.conf
regexp: '<node_name>(.*)</node_name>'
line: "<node_name>{{ worker_name }}</node_name>"
backrefs: yes
regexp: <node_name>(.*)</node_name>
line: <node_name>{{ worker_name }}</node_name>
backrefs: true

- name: Set Wazuh Worker IP
lineinfile:
path: /var/ossec/etc/ossec.conf
regexp: '<node>(.*)</node>'
line: "<node>{{ master_hostname }}</node>"
backrefs: yes
regexp: <node>(.*)</node>
line: <node>{{ master_hostname }}</node>
backrefs: true

- name: enable authd and clusterd debug mode
blockinfile:
path: /var/ossec/etc/local_internal_options.conf
block: |
authd.debug=2
wazuh_clusterd.debug=2
remoted.debug=2
- name: Restart Wazuh
command: /var/ossec/bin/wazuh-control restart
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cluster_key: "00000000000000000000000000000000"

master_hostname: wazuh-master

worker1_hostname: wazuh-worker1
worker2_hostname: wazuh-worker2

agent1_hostname: wazuh-agent1

docker_network: cluster_net

image: dontpanicat/debian:buster

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include_vars: configurations.yaml
Loading

0 comments on commit e634e8d

Please sign in to comment.