-
Notifications
You must be signed in to change notification settings - Fork 46
Adding missing tests from RHEL7 STIG v2r4 #113
base: master
Are you sure you want to change the base?
Changes from all commits
5fc9fa6
d0d8f3d
d5a349e
1668ef9
9ea34a3
0f45a42
df276a6
89b2e95
11e3f8b
af5f594
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# encoding: utf-8 | ||
# | ||
control "V-81009" do | ||
title "The Red Hat Enterprise Linux operating system must mount /dev/shm with the nodev option." | ||
desc " | ||
The \"nodev\" mount option causes the system to not interpret character or block special devices. | ||
Executing character or block special devices from untrusted file systems increases the opportunity | ||
for unprivileged users to attain unauthorized administrative access." | ||
impact 0.5 | ||
tag "gtitle": "SRG-OS-000368-GPOS-00154" | ||
tag "gid": "V-81009" | ||
tag "rid": "SV-95721r1_rule " | ||
tag "stig_id": "RHEL-07-021022" | ||
tag "cci": ["CCI-001764"] | ||
tag "documentable": false | ||
tag "nist": ["CM-6 b", "Rev_4"] | ||
tag "subsystems": ['file_system'] | ||
desc "check", " | ||
Verify that the \"nodev\" option is configured for /dev/shm. | ||
|
||
Check that the operating system is configured to use the \"nodev\" option for /dev/shm with the following command: | ||
|
||
# cat /etc/fstab | grep /dev/shm | grep nodev | ||
|
||
tmpfs /dev/shm tmpfs defaults,nodev,nosuid,noexec 0 0 | ||
|
||
If the \"nodev\" option is not present on the line for \"/dev/shm\", this is a finding. | ||
|
||
Verify \"/dev/shm\" is mounted with the \"nodev\" option: | ||
|
||
# mount | grep \"/dev/shm\" | grep nodev | ||
|
||
If no results are returned, this is a finding. | ||
" | ||
desc "fix", " | ||
Configure the \"/etc/fstab\" to use the \"nodev\" option for all lines containing \"/dev/shm\". | ||
" | ||
|
||
describe mount('/dev/shm') do | ||
its('options') { should include 'nodev' } | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# encoding: utf-8 | ||
# | ||
control "V-81011" do | ||
title "The Red Hat Enterprise Linux operating system must mount /dev/shm with the nosuid option." | ||
desc " | ||
The \"nosuid\" mount option causes the system to not execute \"setuid\" and \setgid\" files with owner privileges. | ||
This option must be used for mounting any file system not containing approved \"setuid\" and \"setguid\" files. | ||
Executing files from untrusted file systems increases the opportunity for unprivileged users to attain | ||
unauthorized administrative access." | ||
impact 0.5 | ||
tag "gtitle": "SRG-OS-000368-GPOS-00154" | ||
tag "gid": "V-81011" | ||
tag "rid": "SV-95723r1_rule" | ||
tag "stig_id": "RHEL-07-021023" | ||
tag "cci": ["CCI-001764"] | ||
tag "documentable": false | ||
tag "nist": ["CM-6 b", "Rev_4"] | ||
tag "subsystems": ['file_system'] | ||
desc "check", " | ||
The \"nosuid\" mount option causes the system to not execute \"setuid\" and \"setgid\" files with owner privileges. | ||
This option must be used for mounting any file system not containing approved \"setuid\" and \"setguid\" files. | ||
Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access. | ||
" | ||
desc "fix", " | ||
Configure the system so that /dev/shm is mounted with the \"nosuid\" option. | ||
" | ||
|
||
describe mount('/dev/shm') do | ||
its('options') { should include 'nosuid' } | ||
end | ||
Comment on lines
+28
to
+30
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. Same as above, but using 'nosuid' |
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# encoding: utf-8 | ||
# | ||
control "V-81013" do | ||
title "The Red Hat Enterprise Linux operating system must mount /dev/shm with the noexec option." | ||
desc "The \"noexec\" mount option causes the system to not execute binary files. This option | ||
must be used for mounting any file system not containing approved binary files as they may be | ||
incompatible. Executing files from untrusted file systems increases the opportunity for unprivileged | ||
users to attain unauthorized administrative access." | ||
impact 0.5 | ||
tag "gtitle": "SRG-OS-000368-GPOS-00154" | ||
tag "gid": "V-81013" | ||
tag "rid": "SV-95725r1_rule" | ||
tag "stig_id": "RHEL-07-001764" | ||
tag "cci": ["CCI-000366"] | ||
tag "documentable": false | ||
tag "nist": ["CM-6 b", "Rev_4"] | ||
tag "subsystems": ['file_system'] | ||
desc "check", " | ||
The \"noexec\" mount option causes the system to not execute binary files. This option must be used | ||
for mounting any file system not containing approved binary files as they may be incompatible. Executing | ||
files from untrusted file systems increases the opportunity for unprivileged users to attain | ||
unauthorized administrative access. | ||
" | ||
desc "fix", " | ||
Configure the system so that /dev/shm is mounted with the \"noexec\" option. | ||
" | ||
|
||
describe mount('/dev/shm') do | ||
its('options') { should include 'noexec' } | ||
end | ||
Comment on lines
+28
to
+30
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. ditto |
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# encoding: utf-8 | ||
# | ||
control "V-81015" do | ||
title "The Red Hat Enterprise Linux operating system must be configured to use the au-remote plugin." | ||
desc " | ||
Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is | ||
a common process in information systems with limited audit storage capacity. Without the configuration of | ||
the \"au-remote\" plugin, the audisp-remote daemon will not off-load the logs from the system being audited. | ||
" | ||
impact 0.5 | ||
tag "gtitle": "SRG-OS-000342-GPOS-00133" | ||
tag "satisfies": ["SRG-OS-000342-GPOS-00133", "SRG-OS-000479-GPOS-00224"] | ||
tag "gid": "V-81015" | ||
tag "rid": "SV-95727r1_rule" | ||
tag "stig_id": "RHEL-07-030200" | ||
tag "cci": ["CCI-001851"] | ||
tag "documentable": false | ||
tag "nist": ["AU-12 c", "Rev_4"] | ||
tag "subsystems": ["audit"] | ||
tag "check_id": "C-80729r1_chk" | ||
tag "fix_id": "F-87849r2_fix" | ||
desc "check", " | ||
Information stored in one location is vulnerable to accidental or incidental deletion or alteration. | ||
|
||
Off-loading is a common process in information systems with limited audit storage capacity. | ||
|
||
Without the configuration of the \"au-remote\" plugin, the audisp-remote daemon will not off-load the logs from the system being audited. | ||
" | ||
desc "fix", " | ||
Edit the /etc/audisp/plugins.d/au-remote.conf file and change the value of \"active\" to \"yes\". | ||
|
||
The audit daemon must be restarted for changes to take effect: | ||
|
||
# service auditd restart | ||
" | ||
|
||
if file('/etc/audisp/plugins.d/au-remote.conf').exist? | ||
describe parse_config_file('/etc/audisp/plugins.d/au-remote.conf') do | ||
its('active') { should match %r{yes$} } | ||
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. using regex here is a bit unneeded. You should trust the parse_config_file, or supply the regex (options + assignment_regex) to extract the exact piece you are looking for. In your case |
||
end | ||
else | ||
describe "File '/etc/audisp/plugins.d/au-remote.conf' cannot be found. This test cannot be checked in a automated fashion and you must check it manually" do | ||
skip "File '/etc/audisp/plugins.d/au-remote.conf' cannot be found. This check must be performed manually" | ||
end | ||
Comment on lines
+41
to
+44
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. It would be interesting to see what additional behavior is acceptable, in this case. The STIG does not allow for additional behavior, so I am uncertain why you are coding manual review as optional. This appears to be a clear pass/fail check. I would remove the if/else control structure and just search for the file. Now the question is, if what you are intending is valid. That is, are there secondary approved options. If this is the case, I would just say implement them here. Give an attribute in that control structure to require organizational documentation stating why this option is valid for their use case. In the end, I would say this is unneeded. What I would expect is exceptions, the likes of which you are allowing to be manually reviewed, to be overridden by organizational inheritance. 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. Agree on this one. The STIG should be modeled exactly. There is no contingency for the file not being there. If it does not exist or does not contain the prescribed value this is a fail. |
||
end | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# encoding: utf-8 | ||
# | ||
control "V-81017" do | ||
title "The Red Hat Enterprise Linux operating system must configure the au-remote plugin to off-load audit logs using the audisp-remote daemon." | ||
desc " | ||
Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a | ||
common process in information systems with limited audit storage capacity. Without the configuration of the \"au-remote\" | ||
plugin, the audisp-remote daemon will not off load the logs from the system being audited. | ||
" | ||
impact 0.5 | ||
tag "gtitle": "SRG-OS-000342-GPOS-00133" | ||
tag "satisfies": ["SRG-OS-000342-GPOS-00133", "SRG-OS-000479-GPOS-00224"] | ||
tag "gid": "V-81017" | ||
tag "rid": "SV-95729r1_rule" | ||
tag "stig_id": "RHEL-07-030210" | ||
tag "cci": ["CCI-001851"] | ||
tag "documentable": false | ||
tag "nist": ["AU-12 c", "Rev_4"] | ||
tag "subsystems": ["audit"] | ||
tag "check_id": "C-80731r2_chk" | ||
tag "fix_id": "F-87851r2_fix" | ||
desc "check", " | ||
Verify the \"au-remote\" plugin is configured to always off-load audit logs using the audisp-remote daemon: | ||
|
||
# cat /etc/audisp/plugins.d/au-remote.conf | grep -v \"^#\" | ||
|
||
active = yes | ||
direction = out | ||
path = /sbin/audisp-remote | ||
type = always | ||
format = string | ||
|
||
If the \"direction\" setting is not set to \"out\", or the line is commented out, this is a finding. | ||
|
||
If the \"path\" setting is not set to \"/sbin/audisp-remote\", or the line is commented out, this is a finding. | ||
|
||
If the \"type\" setting is not set to \"always\", or the line is commented out, this is a finding. | ||
" | ||
desc "fix", " | ||
Edit the /etc/audisp/plugins.d/au-remote.conf file and add or update the following values: | ||
|
||
direction = out | ||
path = /sbin/audisp-remote | ||
type = always | ||
|
||
The audit daemon must be restarted for changes to take effect: | ||
|
||
# service auditd restart | ||
" | ||
|
||
if file('/etc/audisp/plugins.d/au-remote.conf').exist? | ||
describe parse_config_file('/etc/audisp/plugins.d/au-remote.conf') do | ||
its('direction') { should match %r{out$} } | ||
its('path') { should match %r{/sbin/audisp-remote$} } | ||
its('type') { should match %r{always$} } | ||
end | ||
Comment on lines
+52
to
+56
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. Same as above... Plus, the STIG specifically calls out 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. I think you mean it also lists |
||
else | ||
describe "File '/etc/audisp/plugins.d/au-remote.conf' cannot be found. This test cannot be checked in a automated fashion and you must check it manually" do | ||
skip "File '/etc/audisp/plugins.d/au-remote.conf' cannot be found. This check must be performed manually" | ||
end | ||
Comment on lines
+58
to
+60
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. Same as V-81015, this control structure is not needed. |
||
end | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# encoding: utf-8 | ||
# | ||
control "V-81019" do | ||
title "The Red Hat Enterprise Linux operating system must take appropriate action when the audisp-remote buffer is full." | ||
desc " | ||
Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a | ||
common process in information systems with limited audit storage capacity. When the remote buffer is full, audit | ||
logs will not be collected and sent to the central log server. | ||
" | ||
impact 0.5 | ||
tag "gtitle": "SRG-OS-000342-GPOS-00133" | ||
tag "satisfies": ["SRG-OS-000342-GPOS-00133", "SRG-OS-000479-GPOS-00224"] | ||
tag "gid": "V-81019" | ||
tag "rid": "SV-95731r1_rule" | ||
tag "stig_id": "RHEL-07-030210" | ||
tag "cci": ["CCI-001851"] | ||
tag "documentable": false | ||
tag "nist": ["AU-12 c", "Rev_4"] | ||
tag "subsystems": ["audit"] | ||
tag "check_id": "C-80735r1_chk" | ||
tag "fix_id": "F-87853r3_fix" | ||
desc "check", " | ||
Verify the audisp daemon is configured to take an appropriate action when the internal queue is full: | ||
|
||
# grep \"overflow_action\" /etc/audisp/audispd.conf | ||
|
||
overflow_action = syslog | ||
|
||
If the \"overflow_action\" option is not \"syslog\", \"single\", or \"halt\", or the line is commented out, this is a finding. | ||
" | ||
desc "fix", " | ||
Edit the /etc/audisp/audispd.conf file and add or update the \"overflow_action\" option: | ||
|
||
overflow_action = syslog | ||
|
||
The audit daemon must be restarted for changes to take effect: | ||
|
||
# service auditd restart | ||
" | ||
|
||
if file('/etc/audisp/audispd.conf').exist? | ||
describe parse_config_file('/etc/audisp/audispd.conf') do | ||
its('overflow_action') { should match %r{syslog$|single$|halt$} } | ||
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. It would be more clear to use arrays here vs regex. its('overflow_action') { should be_in %w(syslog single halt) } 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. I think this control also needs to check if the line is commented out. 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. How does the |
||
end | ||
else | ||
describe "File '/etc/audisp/audispd.conf' cannot be found. This test cannot be checked in a automated fashion and you must check it manually" do | ||
skip "File '/etc/audisp/audispd.conf' cannot be found. This check must be performed manually" | ||
end | ||
Comment on lines
+46
to
+48
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. Same as above...unneeded control structure. |
||
end | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# encoding: utf-8 | ||
# | ||
control "V-81021" do | ||
title "The Red Hat Enterprise Linux operating system must label all off-loaded audit logs before sending them to the central log server." | ||
desc " | ||
Information stored in one location is vulnerable to accidental or incidental deletion or alteration. | ||
Off-loading is a common process in information systems with limited audit storage capacity. When audit | ||
logs are not labeled before they are sent to a central log server, the audit data will not be able to | ||
be analyzed and tied back to the correct system. | ||
" | ||
impact 0.5 | ||
tag "gtitle": "SRG-OS-000342-GPOS-00133" | ||
tag "satisfies": ["SRG-OS-000342-GPOS-00133", "SRG-OS-000479-GPOS-00224"] | ||
tag "gid": "V-81021" | ||
tag "rid": "SV-95733r1_rule" | ||
tag "stig_id": "RHEL-07-030211" | ||
tag "cci": ["CCI-001851"] | ||
tag "documentable": false | ||
tag "nist": ["AU-12 c", "Rev_4"] | ||
tag "subsystems": ["audit"] | ||
tag "check_id": "C-80737r1_chk" | ||
tag "fix_id": "F-87855r2_fix" | ||
desc "check", " | ||
Verify the audisp daemon is configured to label all off-loaded audit logs: | ||
|
||
# grep \"name_format\" /etc/audisp/audispd.conf | ||
|
||
name_format = hostname | ||
|
||
If the \"name_format\" option is not \"hostname\", \"fqd\", or \"numeric\", or the line is commented out, this is a finding. | ||
" | ||
desc "fix", " | ||
Edit the /etc/audisp/audispd.conf file and add or update the \"name_format\" option: | ||
|
||
name_format = hostname | ||
|
||
The audit daemon must be restarted for changes to take effect: | ||
|
||
# service auditd restart | ||
" | ||
|
||
if file('/etc/audisp/audispd.conf').exist? | ||
describe parse_config_file('/etc/audisp/audispd.conf') do | ||
its('name_format') { should match %r{hostname$|fqd$|\d+} } | ||
end | ||
else | ||
describe "File '/etc/audisp/audispd.conf' cannot be found. This test cannot be checked in a automated fashion and you must check it manually" do | ||
skip "File '/etc/audisp/audispd.conf' cannot be found. This check must be performed manually" | ||
end | ||
Comment on lines
+47
to
+49
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. Same as above....unneeded control structure. |
||
end | ||
|
||
end |
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.
This describe statement only takes into consideration what is currently mounted. It is important to indicate that would be mounted if DR happens (node bounces) and auto-mount procedures take place. We normally weight everything that is configurable upon 2 scales. 1) configuration (what happens when the node is rebooted) and 2) cached (what parameters/settings are currently affecting the node). I think in this case you should include the configuration settings. Here is what that would look like.
It is also important to note that
/etc/mtab
also indicates the status of a healthy system. It is wholly possible for mount to not indicate proper settings (unlikely, but possible). In that case you might want to take this file into consideration.The last possible location to look for 'proper working order' is
/proc/mounts
. Quote from the mount manual:It is also possible that you want to check the cached value in
/proc/mounts
in newer and newer OS versions due to the adoption of systemd*.mounts
files.