-
Notifications
You must be signed in to change notification settings - Fork 188
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
Create auditd rules #158
Open
m41kc0d3
wants to merge
2
commits into
dev-sec:master
Choose a base branch
from
m41kc0d3:Create-auditd-rules
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Create auditd rules #158
Changes from all commits
Commits
Show all changes
2 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
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 @@ | ||
DevSec Linux Baseline | ||
|
||
Huge parts of the audit rules in controls/os_spec.rb | ||
was created by Deutsche Telekom AG. (https://github.com/telekom/tel-it-security-automation/blob/21dacf83ab1245bf7c42c12d1d25292562599b79/hardening-linux-server/vars/main.yml & https://github.com/telekom/tel-it-security-automation) | ||
Copyright (c) 2020 Maximilian Hertstein [...] Deutsche Telekom AG |
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 | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -282,3 +282,43 @@ | |||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
control 'os-15' do | ||||||||||||||||||||||||||||||||
impact 1.0 | ||||||||||||||||||||||||||||||||
title 'Check auditd rules' | ||||||||||||||||||||||||||||||||
desc 'Check that the auditd rules are created and active' | ||||||||||||||||||||||||||||||||
output = command('auditctl -l') | ||||||||||||||||||||||||||||||||
describe output do | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-a always,exit -F arch=b64 -S execve' } | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /etc/localtime -p wa -k time-change' } | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /sbin/insmod -p x -k modules' } | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /etc/crontab' } | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /etc/sudoers -p wa -k scope' } | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /etc/passwd -p wa -k identity' } | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /var/log/audit/audit.log' } | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /etc/hosts -p wa -k system-locale' } | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /etc/ssh/sshd_config' } | ||||||||||||||||||||||||||||||||
if os.redhat? || os.name == 'amazon' || os.name == 'fedora' | ||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you please change this to use linux-baseline/controls/os_spec.rb Lines 153 to 167 in 91a0aa9
|
||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /usr/bin/yum -p x -k software_mgmt' } | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /etc/selinux -p wa -k MAC-policy' } | ||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||
if os.suse? | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /usr/bin/zypper -p x -k software_mgmt' } | ||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||
if os.debian? | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /usr/bin/apt-get -p x -k software_mgmt' } | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /var/log/system.log' } | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /etc/network/interfaces -p wa -k system-locale' } | ||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||
if os.name == 'arch' | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /usr/bin/pacman -p x -k software_mgmt' } | ||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||
if os.redhat? || os.name == 'amazon' || os.name == 'fedora' || os.suse? | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /var/log/messages' } | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /etc/sysconfig/network-scripts -p wa -k system-locale' } | ||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||
if os.suse? || os.debian? | ||||||||||||||||||||||||||||||||
its(:stdout) { should match '-w /etc/apparmor -p wa -k MAC-policy' } | ||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||
end |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think audit is large enough to start an extra file for all the checks and maybe split this up a bit to give it usefull names and descriptions.