Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6869 from yarunachalam/SLES-15-030760
Add Rule,Remediation and Test for SLES-15-030760
- Loading branch information
Showing
10 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
...system/auditing/auditd_configure_rules/audit_rules_session_events_utmp/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,8 @@ | ||
# platform = multi_platform_sle | ||
# reboot = true | ||
# strategy = restrict | ||
# complexity = low | ||
# disruption = low | ||
|
||
{{{ ansible_audit_augenrules_add_watch_rule(path='/run/utmp', permissions='wa', key='session') }}} | ||
{{{ ansible_audit_auditctl_add_watch_rule(path='/run/utmp', permissions='wa', key='session') }}} |
9 changes: 9 additions & 0 deletions
9
...ide/system/auditing/auditd_configure_rules/audit_rules_session_events_utmp/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,9 @@ | ||
# platform = multi_platform_sle | ||
|
||
# Include source function library. | ||
. /usr/share/scap-security-guide/remediation_functions | ||
|
||
# Perform the remediation | ||
# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' | ||
fix_audit_watch_rule "auditctl" "/run/utmp" "wa" "session" | ||
fix_audit_watch_rule "augenrules" "/run/utmp" "wa" "session" |
48 changes: 48 additions & 0 deletions
48
..._os/guide/system/auditing/auditd_configure_rules/audit_rules_session_events_utmp/rule.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,48 @@ | ||
documentation_complete: true | ||
|
||
prodtype: sle15 | ||
|
||
title: 'Record Attempts to Alter Process and Session Initiation Information utmp' | ||
|
||
description: |- | ||
The audit system already collects process information for all | ||
users and root. If the <tt>auditd</tt> daemon is configured to use the | ||
<tt>augenrules</tt> program to read audit rules during daemon startup (the | ||
default), add the following lines to a file with suffix <tt>.rules</tt> in the | ||
directory <tt>/etc/audit/rules.d</tt> in order to watch for attempted manual | ||
edits of files involved in storing such process information: | ||
<pre>-w /run/utmp -p wa -k session</pre> | ||
If the <tt>auditd</tt> daemon is configured to use the <tt>auditctl</tt> | ||
utility to read audit rules during daemon startup, add the following lines to | ||
<tt>/etc/audit/audit.rules</tt> file in order to watch for attempted manual | ||
edits of files involved in storing such process information: | ||
<pre>-w /run/utmp -p wa -k session</pre> | ||
rationale: |- | ||
Manual editing of these files may indicate nefarious activity, such | ||
as an attacker attempting to remove evidence of an intrusion. | ||
severity: medium | ||
|
||
identifiers: | ||
cce@sle15: CCE-85714-4 | ||
|
||
references: | ||
stigid@sle15: SLES-15-030760 | ||
srg: SRG-OS-000472-GPOS-00217 | ||
disa: CCI-000172 | ||
nist: AU-12(c),AU-12.1(iv) | ||
|
||
ocil_clause: 'Audit rule is not present' | ||
|
||
ocil: |- | ||
To Check the file is being audited by performing the following command | ||
<pre> sudo auditctl -l | grep -w '/run/utmp'</pre> | ||
template: | ||
name: audit_rules_login_events | ||
vars: | ||
path: /run/utmp | ||
backends: | ||
ansible: "off" | ||
bash: "off" |
4 changes: 4 additions & 0 deletions
4
...uditd_configure_rules/audit_rules_session_events_utmp/tests/auditctl_correct_utmp.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,4 @@ | ||
#!/bin/bash | ||
|
||
echo "-w /run/utmp -p wa -k session" >> /etc/audit/audit.rules | ||
sed -i "s%^ExecStartPost=.*%ExecStartPost=-/sbin/auditctl%" /usr/lib/systemd/system/auditd.service |
4 changes: 4 additions & 0 deletions
4
...figure_rules/audit_rules_session_events_utmp/tests/auditctl_remove_all_rules_utmp.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,4 @@ | ||
#!/bin/bash | ||
|
||
rm -f /etc/audit/audit.rules | ||
sed -i "s%^ExecStartPost=.*%ExecStartPost=-/sbin/auditctl%" /usr/lib/systemd/system/auditd.service |
4 changes: 4 additions & 0 deletions
4
...td_configure_rules/audit_rules_session_events_utmp/tests/auditctl_wrong_rule_utmp.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,4 @@ | ||
#!/bin/bash | ||
|
||
echo "-w /run/something -p wa -k session" >> /etc/audit/audit.rules | ||
sed -i "s%^ExecStartPost=.*%ExecStartPost=-/sbin/auditctl%" /usr/lib/systemd/system/auditd.service |
5 changes: 5 additions & 0 deletions
5
...itd_configure_rules/audit_rules_session_events_utmp/tests/augenrules_correct_utmp.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,5 @@ | ||
#!/bin/bash | ||
|
||
|
||
mkdir -p /etc/audit/rules.d | ||
echo "-w /run/utmp -p wa -k session" >> /etc/audit/rules.d/login.rules |
6 changes: 6 additions & 0 deletions
6
...gure_rules/audit_rules_session_events_utmp/tests/augenrules_remove_all_rules_utmp.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 | ||
|
||
|
||
mkdir -p /etc/audit/rules.d | ||
rm -f /etc/audit/rules.d/* | ||
> /etc/audit/audit.rules |
5 changes: 5 additions & 0 deletions
5
..._configure_rules/audit_rules_session_events_utmp/tests/augenrules_wrong_rule_utmp.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 | ||
|
||
|
||
mkdir -p /etc/audit/rules.d | ||
echo "-w /run/something -p wa -k session" >> /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