resolving conflicts
This commit is contained in:
parent
e228ead890
commit
6d1594e576
@ -1,65 +0,0 @@
|
|||||||
import os
|
|
||||||
import pytest
|
|
||||||
import testinfra.utils.ansible_runner
|
|
||||||
|
|
||||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|
||||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
|
||||||
|
|
||||||
|
|
||||||
def get_wazuh_version():
|
|
||||||
"""This return the version of Wazuh."""
|
|
||||||
return "4.3.11"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_wazuh_packages_are_installed(host):
|
|
||||||
"""Test the main packages are installed."""
|
|
||||||
manager = host.package("wazuh-manager")
|
|
||||||
assert manager.is_installed
|
|
||||||
assert manager.version.startswith(get_wazuh_version())
|
|
||||||
|
|
||||||
|
|
||||||
def test_wazuh_services_are_running(host):
|
|
||||||
"""Test the services are enabled and running.
|
|
||||||
|
|
||||||
When assert commands are commented, this means that the service command has
|
|
||||||
a wrong exit code: https://github.com/wazuh/wazuh-ansible/issues/107
|
|
||||||
"""
|
|
||||||
# This currently doesn't work with out current Docker base images
|
|
||||||
# manager = host.service("wazuh-manager")
|
|
||||||
# api = host.service("wazuh-api")
|
|
||||||
# assert manager.is_running
|
|
||||||
# assert api.is_running
|
|
||||||
output = host.check_output(
|
|
||||||
'ps aux | grep ossec | tr -s " " | cut -d" " -f11'
|
|
||||||
)
|
|
||||||
assert 'ossec-authd' in output
|
|
||||||
assert 'wazuh-modulesd' in output
|
|
||||||
assert 'wazuh-db' in output
|
|
||||||
assert 'ossec-execd' in output
|
|
||||||
assert 'ossec-monitord' in output
|
|
||||||
assert 'ossec-remoted' in output
|
|
||||||
assert 'ossec-logcollector' in output
|
|
||||||
assert 'ossec-analysisd' in output
|
|
||||||
assert 'ossec-syscheckd' in output
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("wazuh_file, wazuh_owner, wazuh_group, wazuh_mode", [
|
|
||||||
("/var/ossec/etc/sslmanager.cert", "root", "root", 0o640),
|
|
||||||
("/var/ossec/etc/sslmanager.key", "root", "root", 0o640),
|
|
||||||
("/var/ossec/etc/rules/local_rules.xml", "wazuh", "wazuh", 0o640),
|
|
||||||
("/var/ossec/etc/lists/audit-keys", "wazuh", "wazuh", 0o660),
|
|
||||||
])
|
|
||||||
def test_wazuh_files(host, wazuh_file, wazuh_owner, wazuh_group, wazuh_mode):
|
|
||||||
"""Test Wazuh related files exist and have proper owners and mode."""
|
|
||||||
wazuh_file_host = host.file(wazuh_file)
|
|
||||||
assert wazuh_file_host.user == wazuh_owner
|
|
||||||
assert wazuh_file_host.group == wazuh_group
|
|
||||||
assert wazuh_file_host.mode == wazuh_mode
|
|
||||||
|
|
||||||
|
|
||||||
def test_filebeat_is_installed(host):
|
|
||||||
"""Test the elasticsearch package is installed."""
|
|
||||||
filebeat = host.package("filebeat")
|
|
||||||
assert filebeat.is_installed
|
|
||||||
assert filebeat.version.startswith('7.10.2')
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
########################################################
|
|
||||||
# Helper variables
|
|
||||||
private_ip: '{{ ansible_default_ipv4.address }}'
|
|
||||||
|
|
||||||
managers_hostvars: "{{ groups['managers'] | map('extract', hostvars) | list }}"
|
|
||||||
indexer_hostvars: "{{ groups['indexer'] | map('extract', hostvars) | list }}"
|
|
||||||
dashboard_hostvars: "{{ groups['dashboard'] | map('extract', hostvars) | list }}"
|
|
||||||
|
|
||||||
manager_addresses: "{{ managers_hostvars | map(attribute='private_ip') | list }}"
|
|
||||||
indexer_addresses: "{{ indexer_hostvars | map(attribute='private_ip') | list }}"
|
|
||||||
dashboard_addresses: "{{ dashboard_hostvars | map(attribute='private_ip') | list }}"
|
|
||||||
|
|
||||||
########################################################
|
|
||||||
# General Wazuh stack variables
|
|
||||||
|
|
||||||
# Wazuh indexer/dashboard
|
|
||||||
dashboard_security: true
|
|
||||||
|
|
||||||
dashboard_user: kibanaserver
|
|
||||||
indexer_security_user: admin
|
|
||||||
|
|
||||||
dashboard_password: changeme
|
|
||||||
indexer_security_password: changeme
|
|
||||||
indexer_admin_password: changeme
|
|
||||||
|
|
||||||
# All nodes are called by IP name
|
|
||||||
indexer_node_name: '{{ ansible_facts.hostname }}'
|
|
||||||
dashboard_node_name: '{{ ansible_facts.hostname }}'
|
|
||||||
filebeat_node_name: '{{ ansible_facts.hostname }}'
|
|
||||||
|
|
||||||
indexer_version: 4.3.11
|
|
||||||
filebeat_version: 7.10.2
|
|
||||||
wazuh_version: 4.3.11
|
|
||||||
|
|
||||||
# Debian packages need the ${VERSION}-1
|
|
||||||
wazuh_manager_version: 4.3.11
|
|
||||||
wazuh_agent_version: 4.3.11
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
import os
|
|
||||||
import pytest
|
|
||||||
import testinfra.utils.ansible_runner
|
|
||||||
|
|
||||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|
||||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
|
||||||
|
|
||||||
|
|
||||||
def get_wazuh_version():
|
|
||||||
"""This return the version of Wazuh."""
|
|
||||||
return "4.3.11"
|
|
||||||
|
|
||||||
|
|
||||||
def test_wazuh_packages_are_installed(host):
|
|
||||||
"""Test the main packages are installed."""
|
|
||||||
manager = host.package("wazuh-manager")
|
|
||||||
assert manager.is_installed
|
|
||||||
assert manager.version.startswith(get_wazuh_version())
|
|
||||||
|
|
||||||
|
|
||||||
def test_wazuh_services_are_running(host):
|
|
||||||
"""Test the services are enabled and running.
|
|
||||||
|
|
||||||
When assert commands are commented, this means that the service command has
|
|
||||||
a wrong exit code: https://github.com/wazuh/wazuh-ansible/issues/107
|
|
||||||
"""
|
|
||||||
# This currently doesn't work with out current Docker base images
|
|
||||||
# manager = host.service("wazuh-manager")
|
|
||||||
# api = host.service("wazuh-api")
|
|
||||||
# assert manager.is_running
|
|
||||||
# assert api.is_running
|
|
||||||
output = host.check_output(
|
|
||||||
'ps aux | grep ossec | tr -s " " | cut -d" " -f11'
|
|
||||||
)
|
|
||||||
assert 'ossec-authd' in output
|
|
||||||
assert 'wazuh-modulesd' in output
|
|
||||||
assert 'wazuh-db' in output
|
|
||||||
assert 'ossec-execd' in output
|
|
||||||
assert 'ossec-monitord' in output
|
|
||||||
assert 'ossec-remoted' in output
|
|
||||||
assert 'ossec-logcollector' in output
|
|
||||||
assert 'ossec-analysisd' in output
|
|
||||||
assert 'ossec-syscheckd' in output
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("wazuh_file, wazuh_owner, wazuh_group, wazuh_mode", [
|
|
||||||
("/var/ossec/etc/sslmanager.cert", "root", "root", 0o640),
|
|
||||||
("/var/ossec/etc/sslmanager.key", "root", "root", 0o640),
|
|
||||||
("/var/ossec/etc/rules/local_rules.xml", "wazuh", "wazuh", 0o640),
|
|
||||||
("/var/ossec/etc/lists/audit-keys", "wazuh", "wazuh", 0o660),
|
|
||||||
])
|
|
||||||
def test_wazuh_files(host, wazuh_file, wazuh_owner, wazuh_group, wazuh_mode):
|
|
||||||
"""Test Wazuh related files exist and have proper owners and mode."""
|
|
||||||
wazuh_file_host = host.file(wazuh_file)
|
|
||||||
assert wazuh_file_host.user == wazuh_owner
|
|
||||||
assert wazuh_file_host.group == wazuh_group
|
|
||||||
assert wazuh_file_host.mode == wazuh_mode
|
|
||||||
|
|
||||||
|
|
||||||
def test_filebeat_is_installed(host):
|
|
||||||
"""Test the elasticsearch package is installed."""
|
|
||||||
filebeat = host.package("filebeat")
|
|
||||||
assert filebeat.is_installed
|
|
||||||
assert filebeat.version.startswith('7.10.2')
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
[tool.poetry]
|
|
||||||
name = "wazuh-ansible"
|
|
||||||
version = "4.4.1"
|
|
||||||
description = ""
|
|
||||||
authors = ["neonmei <neonmei@pm.me>"]
|
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
|
||||||
python = "^3.6"
|
|
||||||
|
|
||||||
# Pin ansible version to that currently present on awx
|
|
||||||
ansible = "==4.10.0"
|
|
||||||
jinja2 = "^3.0.3"
|
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
|
||||||
pytest = "^7.0"
|
|
||||||
ansible-lint = "^5.4.0"
|
|
||||||
flake8 = "^4.0.1"
|
|
||||||
selinux = "^0.2.1"
|
|
||||||
yamllint = "^1.26.3"
|
|
||||||
|
|
||||||
# minimum version is 3.0.3, because we need docker memory limitation
|
|
||||||
# https://github.com/ansible-community/molecule/pull/2615
|
|
||||||
molecule = {extras = ["docker"], version = "==3.3.4"}
|
|
||||||
testinfra = "^6.0.0"
|
|
||||||
|
|
||||||
[build-system]
|
|
||||||
requires = ["poetry>=1.1.8"]
|
|
||||||
build-backend = "poetry.masonry.api"
|
|
||||||
Loading…
Reference in New Issue
Block a user