-
Notifications
You must be signed in to change notification settings - Fork 710
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change rule to use variable when auditing faillock
Some benchmarks specify different paths when monitoring the faillock file, depending on if a permanent faillock path has been configured. This updates the audit_rules_login_event_faillock to use the variable var_accounts_passwords_pam_faillock_dir instead of the profile faillock_path
- Loading branch information
1 parent
4df8db3
commit 543b228
Showing
20 changed files
with
142 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ interactive: false | |
options: | ||
ol8: "/var/log/faillock" | ||
default: "/var/log/faillock" | ||
run: "/var/run/faillock" |
9 changes: 9 additions & 0 deletions
9
...d_configure_rules/audit_login_events/audit_rules_login_events_faillock/ansible/shared.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# platform = multi_platform_rhel,multi_platform_fedora,multi_platform_ol,multi_platform_rhv,multi_platform_sle,multi_platform_ubuntu | ||
# reboot = true | ||
# strategy = restrict | ||
# complexity = low | ||
# disruption = low | ||
|
||
{{{ ansible_instantiate_variables("var_accounts_passwords_pam_faillock_dir") }}} | ||
{{{ ansible_audit_augenrules_add_watch_rule(path="{{ var_accounts_passwords_pam_faillock_dir }}", permissions='wa', key='logins') }}} | ||
{{{ ansible_audit_auditctl_add_watch_rule(path="{{ var_accounts_passwords_pam_faillock_dir }}", permissions='wa', key='logins') }}} |
6 changes: 6 additions & 0 deletions
6
...uditd_configure_rules/audit_login_events/audit_rules_login_events_faillock/bash/shared.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# platform = multi_platform_rhel,multi_platform_fedora,multi_platform_ol,multi_platform_rhv,multi_platform_sle,multi_platform_ubuntu | ||
|
||
# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' | ||
{{{ bash_instantiate_variables("var_accounts_passwords_pam_faillock_dir") }}} | ||
{{{ bash_fix_audit_watch_rule("auditctl", "$var_accounts_passwords_pam_faillock_dir", "wa", "logins") }}} | ||
{{{ bash_fix_audit_watch_rule("augenrules", "$var_accounts_passwords_pam_faillock_dir", "wa", "logins") }}} |
47 changes: 47 additions & 0 deletions
47
...ditd_configure_rules/audit_login_events/audit_rules_login_events_faillock/oval/shared.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<def-group> | ||
<definition class="compliance" id="audit_rules_login_events_faillock" version="2"> | ||
{{{ oval_metadata("Audit rules should be configured to log successful and unsuccessful login and logout events.") }}} | ||
|
||
<criteria operator="OR"> | ||
|
||
<!-- Test the augenrules case --> | ||
<criteria operator="AND"> | ||
<extend_definition comment="audit augenrules" definition_ref="audit_rules_augenrules" /> | ||
<criterion comment="audit augenrules faillock path" test_ref="test_arle_faillock_path_augenrules" /> | ||
</criteria> | ||
|
||
<!-- Test the auditctl case --> | ||
<criteria operator="AND"> | ||
<extend_definition comment="audit auditctl" definition_ref="audit_rules_auditctl" /> | ||
<criterion comment="audit auditctl faillock path" test_ref="test_arle_faillock_path_auditctl" /> | ||
</criteria> | ||
|
||
</criteria> | ||
</definition> | ||
|
||
<ind:textfilecontent54_test check="all" comment="audit augenrules faillock path" id="test_arle_faillock_path_augenrules" version="1"> | ||
<ind:object object_ref="object_arle_faillock_path_augenrules" /> | ||
</ind:textfilecontent54_test> | ||
<ind:textfilecontent54_object id="object_arle_faillock_path_augenrules" version="1"> | ||
<ind:filepath operation="pattern match">^/etc/audit/rules\.d/.*\.rules$</ind:filepath> | ||
<ind:pattern operation="pattern match" var_ref="object_var_accounts_passwords_pam_faillock_dir_pattern"/> | ||
<ind:instance datatype="int">1</ind:instance> | ||
</ind:textfilecontent54_object> | ||
|
||
<ind:textfilecontent54_test check="all" comment="audit auditctl faillock path" id="test_arle_faillock_path_auditctl" version="1"> | ||
<ind:object object_ref="object_arle_faillock_path_auditctl" /> | ||
</ind:textfilecontent54_test> | ||
<ind:textfilecontent54_object id="object_arle_faillock_path_auditctl" version="1"> | ||
<ind:filepath>/etc/audit/audit.rules</ind:filepath> | ||
<ind:pattern operation="pattern match" var_ref="object_var_accounts_passwords_pam_faillock_dir_pattern" /> | ||
<ind:instance datatype="int">1</ind:instance> | ||
</ind:textfilecontent54_object> | ||
<local_variable id="object_var_accounts_passwords_pam_faillock_dir_pattern" comment="The composite pattern used to detect if audit as been configured" datatype="string" version="1"> | ||
<concat> | ||
<literal_component>^\-w[\s]+</literal_component> | ||
<variable_component var_ref="var_accounts_passwords_pam_faillock_dir"/> | ||
<literal_component>[\s]+\-p[\s]+\b([rx]*w[rx]*a[rx]*|[rx]*a[rx]*w[rx]*)\b.*$</literal_component> | ||
</concat> | ||
</local_variable> | ||
<external_variable id="var_accounts_passwords_pam_faillock_dir" comment="Faillock directory" datatype="string" version="1"/> | ||
</def-group> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...rules/audit_login_events/audit_rules_login_events_faillock/tests/auditctl_correct.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
# packages = audit | ||
|
||
{{{ bash_instantiate_variables("var_accounts_passwords_pam_faillock_dir") }}} | ||
echo "-w $var_accounts_passwords_pam_faillock_dir -p wa -k logins" >> /etc/audit/audit.rules | ||
sed -i "s%^ExecStartPost=.*%ExecStartPost=-/sbin/auditctl%" /usr/lib/systemd/system/auditd.service |
6 changes: 6 additions & 0 deletions
6
..._events/audit_rules_login_events_faillock/tests/auditctl_correct_extra_permission.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
# packages = audit | ||
|
||
{{{ bash_instantiate_variables("var_accounts_passwords_pam_faillock_dir") }}} | ||
echo "-w $var_accounts_passwords_pam_faillock_dir -p wra -k logins" >> /etc/audit/audit.rules | ||
sed -i "s%^ExecStartPost=.*%ExecStartPost=-/sbin/auditctl%" /usr/lib/systemd/system/auditd.service |
6 changes: 6 additions & 0 deletions
6
...login_events/audit_rules_login_events_faillock/tests/auditctl_correct_without_key.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
# packages = audit | ||
|
||
{{{ bash_instantiate_variables("var_accounts_passwords_pam_faillock_dir") }}} | ||
echo "-w $var_accounts_passwords_pam_faillock_dir -p wa" >> /etc/audit/audit.rules | ||
sed -i "s%^ExecStartPost=.*%ExecStartPost=-/sbin/auditctl%" /usr/lib/systemd/system/auditd.service |
5 changes: 5 additions & 0 deletions
5
...it_login_events/audit_rules_login_events_faillock/tests/auditctl_remove_all_rules.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
# packages = audit | ||
|
||
rm -f /etc/audit/audit.rules | ||
sed -i "s%^ExecStartPost=.*%ExecStartPost=-/sbin/auditctl%" /usr/lib/systemd/system/auditd.service |
6 changes: 6 additions & 0 deletions
6
...es/audit_login_events/audit_rules_login_events_faillock/tests/auditctl_wrong_rule.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
# packages = audit | ||
|
||
{{{ bash_instantiate_variables("var_accounts_passwords_pam_faillock_dir") }}} | ||
echo "-w $var_accounts_passwords_pam_faillock_dir -p w -k logins" >> /etc/audit/audit.rules | ||
sed -i "s%^ExecStartPost=.*%ExecStartPost=-/sbin/auditctl%" /usr/lib/systemd/system/auditd.service |
5 changes: 5 additions & 0 deletions
5
...in_events/audit_rules_login_events_faillock/tests/auditctl_wrong_rule_without_key.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
# packages = audit | ||
|
||
echo "-w {{{ PATH }}} -p w" >> /etc/audit/audit.rules | ||
sed -i "s%^ExecStartPost=.*%ExecStartPost=-/sbin/auditctl%" /usr/lib/systemd/system/auditd.service |
6 changes: 6 additions & 0 deletions
6
...les/audit_login_events/audit_rules_login_events_faillock/tests/augenrules_correct.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
# packages = audit | ||
|
||
|
||
{{{ bash_instantiate_variables("var_accounts_passwords_pam_faillock_dir") }}} | ||
echo "-w $var_accounts_passwords_pam_faillock_dir -p wa -k login" >> /etc/audit/rules.d/login.rules |
6 changes: 6 additions & 0 deletions
6
...vents/audit_rules_login_events_faillock/tests/augenrules_correct_extra_permission.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
# packages = audit | ||
|
||
|
||
{{{ bash_instantiate_variables("var_accounts_passwords_pam_faillock_dir") }}} | ||
echo "-w $var_accounts_passwords_pam_faillock_dir -p wra -k login" >> /etc/audit/rules.d/login.rules |
6 changes: 6 additions & 0 deletions
6
...gin_events/audit_rules_login_events_faillock/tests/augenrules_correct_without_key.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
# packages = audit | ||
|
||
|
||
{{{ bash_instantiate_variables("var_accounts_passwords_pam_faillock_dir") }}} | ||
echo "-w $var_accounts_passwords_pam_faillock_dir -p wa" >> /etc/audit/rules.d/login.rules |
5 changes: 5 additions & 0 deletions
5
..._login_events/audit_rules_login_events_faillock/tests/augenrules_remove_all_rules.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
# packages = audit | ||
|
||
rm -f /etc/audit/rules.d/* | ||
> /etc/audit/audit.rules |
6 changes: 6 additions & 0 deletions
6
.../audit_login_events/audit_rules_login_events_faillock/tests/augenrules_wrong_rule.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
# packages = audit | ||
|
||
|
||
{{{ bash_instantiate_variables("var_accounts_passwords_pam_faillock_dir") }}} | ||
echo "-w $var_accounts_passwords_pam_faillock_dir -p w -k login" >> /etc/audit/rules.d/login.rules |
6 changes: 6 additions & 0 deletions
6
..._events/audit_rules_login_events_faillock/tests/augenrules_wrong_rule_without_key.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
# packages = audit | ||
|
||
|
||
{{{ bash_instantiate_variables("var_accounts_passwords_pam_faillock_dir") }}} | ||
echo "-w $var_accounts_passwords_pam_faillock_dir -p w" >> /etc/audit/rules.d/login.rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters