-
Notifications
You must be signed in to change notification settings - Fork 744
Add Rule,Remediation and Test for SLES-15-030770 #6933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
vojtapolasek
merged 4 commits into
ComplianceAsCode:master
from
yarunachalam:SLES-15-030770
May 12, 2021
+94
−0
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
...system/auditing/auditd_configure_rules/audit_rules_session_events_wtmp/ansible/shared.yml
This file contains hidden or 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='/var/log/wtmp', permissions='wa', key='session') }}} | ||
{{{ ansible_audit_auditctl_add_watch_rule(path='/var/log/wtmp', permissions='wa', key='session') }}} |
9 changes: 9 additions & 0 deletions
9
...ide/system/auditing/auditd_configure_rules/audit_rules_session_events_wtmp/bash/shared.sh
This file contains hidden or 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" "/var/log/wtmp" "wa" "session" | ||
fix_audit_watch_rule "augenrules" "/var/log/wtmp" "wa" "session" |
48 changes: 48 additions & 0 deletions
48
..._os/guide/system/auditing/auditd_configure_rules/audit_rules_session_events_wtmp/rule.yml
This file contains hidden or 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 wtmp' | ||
|
||
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 /var/log/wtmp -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 /var/log/wtmp -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-85757-3 | ||
|
||
references: | ||
stigid@sle15: SLES-15-030770 | ||
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: |- | ||
Check that the file is being audited by performing the following command: | ||
<pre> sudo auditctl -l | grep -w '/var/log/wtmp'</pre> | ||
|
||
template: | ||
name: audit_rules_login_events | ||
vars: | ||
path: /var/log/wtmp | ||
backends: | ||
ansible: "off" | ||
bash: "off" |
4 changes: 4 additions & 0 deletions
4
...uditd_configure_rules/audit_rules_session_events_wtmp/tests/auditctl_correct_wtmp.pass.sh
This file contains hidden or 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 /var/log/wtmp -p wa -k logins" >> /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_wtmp/tests/auditctl_remove_all_rules_wtmp.fail.sh
8000
This file contains hidden or 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_wtmp/tests/auditctl_wrong_rule_wtmp.fail.sh
This file contains hidden or 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 /var/log/something -p wa -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
...itd_configure_rules/audit_rules_session_events_wtmp/tests/augenrules_correct_wtmp.pass.sh
This file contains hidden or 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
8000
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
|
||
mkdir -p /etc/audit/rules.d | ||
echo "-w /var/log/wtmp -p wa -k logins" >> /etc/audit/rules.d/login.rules |
6 changes: 6 additions & 0 deletions
6
...gure_rules/audit_rules_session_events_wtmp/tests/augenrules_remove_all_rules_wtmp.fail.sh
This file contains hidden or 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_wtmp/tests/augenrules_wrong_rule_wtmp.fail.sh
This file contains hidden or 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 /var/log/something -p wa -k logins" >> /etc/audit/rules.d/login.rules |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.