-
Notifications
You must be signed in to change notification settings - Fork 717
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 #12192 from teacup-on-rockingchair/slmicro5_auth_s…
…ecurity_rules Slmicro5 auth,security and audit STIG rules
- Loading branch information
Showing
36 changed files
with
280 additions
and
47 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
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
5 changes: 5 additions & 0 deletions
5
...pam/locking_out_password_attempts/accounts_passwords_pam_faildelay_delay/bash/slmicro5.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 @@ | ||
# platform = multi_platform_slmicro5 | ||
|
||
{{{ bash_instantiate_variables("var_password_pam_delay") }}} | ||
|
||
{{{ bash_ensure_pam_module_options('/etc/pam.d/common-auth', 'auth', 'required', 'pam_faildelay.so', 'delay', "$var_password_pam_delay", "$var_password_pam_delay") }}} |
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
47 changes: 47 additions & 0 deletions
47
...ts/accounts-pam/locking_out_password_attempts/accounts_passwords_pam_tally2_file/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,47 @@ | ||
documentation_complete: true | ||
|
||
title: 'SLEM 5 must use the default pam_tally2 tally directory.' | ||
|
||
description: |- | ||
This rule configures the system to use default pam_tally2 tally directory | ||
rationale: |- | ||
By limiting the number of failed logon attempts, the risk of unauthorized | ||
system access via user password guessing, otherwise known as | ||
brute-force attacks, is reduced. Limits are imposed by locking the account. | ||
severity: medium | ||
|
||
identifiers: | ||
cce@slmicro5: CCE-94089-0 | ||
|
||
references: | ||
disa: CCI-000044 | ||
nist@slmicro5: AC-7(a) | ||
srg: SRG-OS-000021-GPOS-00005 | ||
|
||
ocil_clause: 'file= is set to /var/log/tallylog or missing' | ||
|
||
ocil: |- | ||
Verify the location of the default tallylog file for the pam_tally2 module, | ||
with the following command | ||
<pre>$sudo grep -R pam_tally2 /etc/pam.d/login | grep "file=" | grep -v "^#"</pre> | ||
fixtext: |- | ||
Configure SLEM 5 to use the default pam_tally2 tally directory | ||
Modify the content of <tt>/etc/pam.d/login</tt>, like this: | ||
<pre>sudo sed -ri 's/\s+file=\S+\s+/ /g' /etc/pam.d/login</tt> </pre> | ||
platform: package[pam] | ||
|
||
template: | ||
name: pam_options | ||
vars: | ||
path: /etc/pam.d/login | ||
type: auth | ||
control_flag: required | ||
module: pam_tally2.so | ||
arguments: | ||
- argument: file | ||
argument_match: .* | ||
remove_argument: file= |
17 changes: 17 additions & 0 deletions
17
...assword_attempts/accounts_passwords_pam_tally2_file/tests/pam_tally2_file_default.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,17 @@ | ||
#!/bin/bash | ||
# platform = multi_platform_slmicro5 | ||
|
||
cat >/etc/pam.d/common-account <<CAPTC | ||
account [success=1 new_authtok_reqd=done default=ignore] pam_unix.so | ||
account requisite pam_deny.so | ||
account required pam_tally2.so | ||
account required pam_permit.so | ||
CAPTC | ||
|
||
cat >/etc/pam.d/login <<CAPTUTC | ||
auth required pam_tally2.so file=/var/log/tallylog | ||
auth [success=1 default=ignore] pam_unix.so nullok_secure | ||
auth requisite pam_deny.so | ||
auth required pam_permit.so | ||
auth optional pam_cap.so | ||
CAPTUTC |
17 changes: 17 additions & 0 deletions
17
...ord_attempts/accounts_passwords_pam_tally2_file/tests/pam_tally2_file_non_default.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,17 @@ | ||
#!/bin/bash | ||
# platform = multi_platform_slmicro5 | ||
|
||
cat >/etc/pam.d/common-account <<CAPTC | ||
account [success=1 new_authtok_reqd=done default=ignore] pam_unix.so | ||
account requisite pam_deny.so | ||
account required pam_tally2.so | ||
account required pam_permit.so | ||
CAPTC | ||
|
||
cat >/etc/pam.d/login <<CAPTUTA | ||
auth required pam_tally2.so file=/var/log/pam_tally2.log | ||
auth [success=1 default=ignore] pam_unix.so nullok_secure | ||
auth requisite pam_deny.so | ||
auth required pam_permit.so | ||
auth optional pam_cap.so | ||
CAPTUTA |
17 changes: 17 additions & 0 deletions
17
...rd_attempts/accounts_passwords_pam_tally2_file/tests/pam_tally2_file_unconfigured.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,17 @@ | ||
#!/bin/bash | ||
# platform = multi_platform_slmicro5 | ||
|
||
cat >/etc/pam.d/common-account <<CAPTC | ||
account [success=1 new_authtok_reqd=done default=ignore] pam_unix.so | ||
account requisite pam_deny.so | ||
account required pam_tally2.so | ||
account required pam_permit.so | ||
CAPTC | ||
|
||
cat >/etc/pam.d/login <<CAPTUTC | ||
auth required pam_tally2.so deny=3 | ||
auth [success=1 default=ignore] pam_unix.so nullok_secure | ||
auth requisite pam_deny.so | ||
auth required pam_permit.so | ||
auth optional pam_cap.so | ||
CAPTUTC |
15 changes: 15 additions & 0 deletions
15
...cking_out_password_attempts/accounts_passwords_pam_tally2_file_selinux/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,15 @@ | ||
# platform = multi_platform_slmicro5 | ||
# reboot = false | ||
# strategy = restrict | ||
# complexity = low | ||
# disruption = low | ||
|
||
|
||
- name: {{{ rule_title }}} - Set up SELinux context for /var/log/tallylog | ||
ansible.builtin.shell: |- | ||
if ! semanage fcontext -a -t faillog_t /var/log/tallylog; then | ||
semanage fcontext -m -t faillog_t /var/log/tallylog | ||
fi | ||
- name: {{{ rule_title }}} - Restore SELinux context on /var/log/tallylog | ||
ansible.builtin.command: restorecon -R -v /var/log/tallylog |
7 changes: 7 additions & 0 deletions
7
...m/locking_out_password_attempts/accounts_passwords_pam_tally2_file_selinux/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,7 @@ | ||
#!/bin/bash | ||
# platform = multi_platform_slmicro5 | ||
|
||
if ! semanage fcontext -a -t faillog_t "/var/log/tallylog"; then | ||
semanage fcontext -m -t faillog_t "/var/log/tallylog" | ||
fi | ||
restorecon -R -v "/var/log/tallylog" |
28 changes: 28 additions & 0 deletions
28
.../locking_out_password_attempts/accounts_passwords_pam_tally2_file_selinux/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,28 @@ | ||
<def-group> | ||
<definition class="compliance" id="{{{ rule_id }}}" version="1"> | ||
{{{ oval_metadata("An SELinux Context faillog_t must be configured for the pam_tally2 file option.") }}} | ||
<criteria operator="OR"> | ||
<criterion test_ref="test_account_password_selinux_pam_tally2_file" | ||
comment="The pam_tally2 file should have faillog_t as context"/> | ||
</criteria> | ||
</definition> | ||
|
||
<linux:selinuxsecuritycontext_test id="test_account_password_selinux_pam_tally2_file" version="2" | ||
check="all" check_existence="all_exist" | ||
comment="faillog_t context is set in pam_tally2.so tally file"> | ||
<linux:object object_ref="object_account_password_selinux_pam_tally2_file"/> | ||
<linux:state state_ref="state_account_password_selinux_pam_tally2_file"/> | ||
</linux:selinuxsecuritycontext_test> | ||
|
||
<linux:selinuxsecuritycontext_object id="object_account_password_selinux_pam_tally2_file" | ||
comment="SELinux context information for pam_tall2.so default file /var/log/tallylog" version="1"> | ||
<linux:filepath>/var/log/tallylog</linux:filepath> | ||
</linux:selinuxsecuritycontext_object> | ||
|
||
<linux:selinuxsecuritycontext_state id="state_account_password_selinux_pam_tally2_file" version="1" | ||
comment="faillog_t context is set"> | ||
<linux:type datatype="string" operation="equals">faillog_t</linux:type> | ||
</linux:selinuxsecuritycontext_state> | ||
|
||
|
||
</def-group> |
47 changes: 47 additions & 0 deletions
47
...nts-pam/locking_out_password_attempts/accounts_passwords_pam_tally2_file_selinux/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,47 @@ | ||
documentation_complete: true | ||
|
||
title: 'An SELinux Context must be configured for default pam_tally2 file option' | ||
|
||
description: |- | ||
The <tt>file</tt> configuration option in PAM pam_tally2.so module defines where to keep counts. | ||
Default is /var/log/tallylog. The configured directory must have the correct SELinux context. | ||
rationale: |- | ||
Not having the correct SELinux context on the pam_tally2.so file may lead to | ||
unauthorized access to the directory. | ||
severity: medium | ||
|
||
identifiers: | ||
cce@slmicro5: CCE-94088-2 | ||
|
||
references: | ||
disa: CCI-000044 | ||
nist: AC-7 (a) | ||
srg: SRG-OS-000021-GPOS-00005 | ||
|
||
platform: package[pam] | ||
|
||
ocil_clause: 'the security context type of the non-default tally directory is not "faillog_t"' | ||
|
||
ocil: |- | ||
If the system does not have SELinux enabled and enforcing a targeted policy, | ||
or if the pam_tally2 module is not configured for use, this requirement is not applicable | ||
Check the security context type of the default tally2 directory with the following command: | ||
$ sudo ls -Z /var/log/tallylog | ||
unconfined_u:object_r:faillog_t:s0 /var/log/faillock | ||
If the security context type of the tally directory is not "faillog_t", this is a finding. | ||
fixtext: |- | ||
Update the /etc/selinux/targeted/contexts/files/file_contexts.local with "faillog_t" context | ||
type for the default pam_tally2 tally directory with the following command: | ||
$ sudo semanage fcontext -a -t faillog_t "/var/log/tallylog" | ||
Next, update the context type of the default tallylog directory/subdirectories and files with the following command: | ||
$ sudo restorecon -R -v /var/log/tallylog |
5 changes: 5 additions & 0 deletions
5
..._out_password_attempts/accounts_passwords_pam_tally2_file_selinux/tests/faillog_t.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 | ||
# packages = policycoreutils-python-utils | ||
# platform = multi_platform_slmicro5 | ||
|
||
semanage fcontext -m -t faillog_t "/var/log/tallylog" |
Oops, something went wrong.