Skip to content

Commit 8bbf202

Browse files
committed
Adds new testinfra test for ossec
We verify that Xenial uses sysv script, and Focal is using the ossec.service file to start the service in the mon server.
1 parent 5ff15ac commit 8bbf202

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

molecule/testinfra/mon/test_ossec_server.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
securedrop_test_vars = testutils.securedrop_test_vars
77
testinfra_hosts = [securedrop_test_vars.monitor_hostname]
8+
python_version = securedrop_test_vars.python_version
89

910

1011
def test_ossec_connectivity(host):
@@ -20,6 +21,19 @@ def test_ossec_connectivity(host):
2021
c = host.check_output("/var/ossec/bin/list_agents -a")
2122
assert c == desired_output
2223

24+
def test_service_start_style(host):
25+
"""
26+
Ensures to check that the service starts via sysv scrip in Xenial, and
27+
uses the systemd service in Focal.
28+
"""
29+
if python_version == "3.8":
30+
value = "/etc/systemd/system/ossec.service"
31+
else:
32+
value = "/etc/init.d/ossec"
33+
with host.sudo():
34+
c = host.check_output("systemctl status ossec")
35+
assert value in c
36+
2337

2438
# Permissions don't match between Ansible and OSSEC deb packages postinst.
2539
@pytest.mark.xfail

0 commit comments

Comments
 (0)