Skip to content

Commit e4c164c

Browse files
committed
enable oval checks for audit tools on fedora and fix failing tests
1 parent d51d00e commit e4c164c

14 files changed

Lines changed: 41 additions & 2 deletions

shared/checks/oval/audit_rules_auditctl.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<ind:object object_ref="object_audit_rules_auditctl" />
1919
</ind:textfilecontent54_test>
2020
<ind:textfilecontent54_object id="object_audit_rules_auditctl" version="1">
21-
{{% if product in ['rhel10', 'ol10'] %}}
21+
{{% if product in ['fedora', 'rhel10', 'ol10'] %}}
2222
<ind:filepath>/usr/lib/systemd/system/audit-rules.service</ind:filepath>
2323
<ind:pattern operation="pattern match">^ExecStart=\/sbin\/auditctl.*$</ind:pattern>
2424
{{% else %}}

shared/checks/oval/audit_rules_augenrules.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<ind:object object_ref="object_audit_rules_augenrules" />
1919
</ind:textfilecontent54_test>
2020
<ind:textfilecontent54_object id="object_audit_rules_augenrules" version="1">
21-
{{% if product in ['rhel10', 'ol10'] %}}
21+
{{% if product in ['fedora', 'rhel10', 'ol10'] %}}
2222
<ind:filepath>/usr/lib/systemd/system/audit-rules.service</ind:filepath>
2323
<ind:pattern operation="pattern match">^ExecStart=(\/usr|)?\/sbin\/augenrules.*$</ind:pattern>
2424
{{% else %}}

shared/macros/20-test-scenarios.jinja

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ This macro changes the configuration of the audit service so that it looks like
1515
{{%- endmacro -%}}
1616

1717

18+
{{#
19+
This macro changes the configuration of the audit service so that it looks like augenrules is used to load rules.
20+
#}}
21+
22+
{{%- macro setup_augenrules_environment () -%}}
23+
{{% if product in ["fedora", "ol10", "rhel10"] %}}
24+
sed -i "s%^ExecStart=.*%ExecStart=/sbin/augenrules%" /usr/lib/systemd/system/audit-rules.service
25+
{{% else %}}
26+
{{% if product == "sle15" %}}
27+
sed -i "s%^#ExecStartPost=.*%ExecStartPost=-/sbin/augenrules%" /usr/lib/systemd/system/auditd.service
28+
{{% else %}}
29+
sed -i "s%^ExecStartPost=.*%ExecStartPost=-/sbin/augenrules%" /usr/lib/systemd/system/auditd.service
30+
{{% endif %}}
31+
{{% endif %}}
32+
{{%- endmacro -%}}
33+
34+
1835
{{#
1936
This macro is used by pam_account_password_faillock template to initialize
2037
the external variable and parameter value to a desired state.

shared/templates/audit_rules_watch/tests/augenrules_correct.pass.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/bash
22
# packages = audit
33

4+
{{{ setup_augenrules_environment() }}}
5+
46
path={{{ PATH }}}
57
style={{{ audit_watches_style }}}
68
filter_type={{{ FILTER_TYPE }}}

shared/templates/audit_rules_watch/tests/augenrules_correct_extra_permission.pass.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/bash
22
# packages = audit
33

4+
{{{ setup_augenrules_environment() }}}
5+
46
path={{{ PATH }}}
57
style={{{ audit_watches_style }}}
68
filter_type={{{ FILTER_TYPE }}}

shared/templates/audit_rules_watch/tests/augenrules_correct_without_key.pass.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/bash
22
# packages = audit
33

4+
{{{ setup_augenrules_environment() }}}
5+
46
path={{{ PATH }}}
57
style={{{ audit_watches_style }}}
68
filter_type={{{ FILTER_TYPE }}}

shared/templates/audit_rules_watch/tests/augenrules_remove_all_rules.fail.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/bash
22
# packages = audit
33

4+
{{{ setup_augenrules_environment() }}}
5+
46
path={{{ PATH }}}
57
style={{{ audit_watches_style }}}
68
filter_type={{{ FILTER_TYPE }}}

shared/templates/audit_rules_watch/tests/augenrules_wrong_rule.fail.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/bash
22
# packages = audit
33

4+
{{{ setup_augenrules_environment() }}}
5+
46
path={{{ PATH }}}
57
style={{{ audit_watches_style }}}
68
filter_type={{{ FILTER_TYPE }}}

shared/templates/audit_rules_watch/tests/augenrules_wrong_rule_without_key.fail.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/bash
22
# packages = audit
33

4+
{{{ setup_augenrules_environment() }}}
5+
46
path={{{ PATH }}}
57
style={{{ audit_watches_style }}}
68
filter_type={{{ FILTER_TYPE }}}

shared/templates/audit_rules_watch/tests/rules_not_there.fail.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22
# packages = audit
33

4+
{{{ setup_augenrules_environment() }}}
45

56
rm -f /etc/audit/rules.d/*
67
> /etc/audit/audit.rules

0 commit comments

Comments
 (0)