diff --git a/linux_os/guide/system/auditing/authconfig_config_files_symlinks/oval/shared.xml b/linux_os/guide/system/auditing/authconfig_config_files_symlinks/oval/shared.xml new file mode 100644 index 00000000000..ce090899fb9 --- /dev/null +++ b/linux_os/guide/system/auditing/authconfig_config_files_symlinks/oval/shared.xml @@ -0,0 +1,48 @@ + + + {{{ oval_metadata("Ensure system-auth and password-auth files are symbolic links pointing to system-auth-local and password-auth-local") }}} + + + + + + + + + + + + + + + + + + /etc/pam.d/system-auth + + + + /etc/pam.d/password-auth + + + + /etc/pam.d/system-auth-local + + + + /etc/pam.d/password-auth-local + + diff --git a/linux_os/guide/system/auditing/authconfig_config_files_symlinks/rule.yml b/linux_os/guide/system/auditing/authconfig_config_files_symlinks/rule.yml new file mode 100644 index 00000000000..179a7b8bdaf --- /dev/null +++ b/linux_os/guide/system/auditing/authconfig_config_files_symlinks/rule.yml @@ -0,0 +1,75 @@ +documentation_complete: true + +prodtype: ol7,rhel7 + +title: |- + Ensure system-auth and password-auth files are symbolic links pointing + to system-auth-local and password-auth-local + +description: |- + {{{ full_name }}} must be configured to prevent overwriting of custom authentication + configuration settings by the authconfig utility. + This can be avoided by creating new local configuration files and creating new or moving + existing symbolic links to them. The authconfig utility will recognize the local configuration + files and not overwrite them, while writing its own settings to the original configuration + files. + +rationale: |- + When using the authconfig utility to modify authentication configuration settings, + the "system-auth" and "password-auth" files and any custom settings that they may + contain are overwritten. + +severity: medium + +identifiers: + cce@rhel7: CCE-86062-7 + +references: + disa: CCI-000196 + srg: SRG-OS-000073-GPOS-00041 + stigid@ol7: OL07-00-010199 + stigid@rhel7: RHEL-07-010199 + +warnings: + - general: |- + This rule doesn't come with a remediation. PAM files are very sensible to ordering and + custom PAM files make it nearly impossible to design an automated remediation that + is safe to use for all cases. + +ocil_clause: |- + The system-auth and password-auth files are not symbolic links or they + do not point to system-auth-local password-auth-local + +ocil: |- + Verify "system-auth" and "password-auth" files are symbolic + links pointing to "system-auth-local" and "password-auth-local": +
$ sudo ls -l /etc/pam.d/{password,system}-auth
+ +fixtext: |- + Create custom configuration files and their corresponding symbolic links: + + Rename the existing configuration files + (skip this step if symbolic links are already present): +
$ sudo mv /etc/pam.d/system-auth /etc/pam.d/system-auth-ac
+
$ sudo mv /etc/pam.d/password-auth /etc/pam.d/password-auth-ac
+ + Create custom system- and password-auth configuration file: +
$ sudo touch /etc/pam.d/{system,password}-auth-local
+ + Make sure the custom config files include the -ac files: +
(type)     include       password-auth-ac
+ + Create new or move existing symbolic links to the new custom configuration files: +
$ sudo ln -sf /etc/pam.d/system-auth-local /etc/pam.d/system-auth
+
$ sudo ln -sf /etc/pam.d/password-auth-local /etc/pam.d/password-auth
+ + Once finished, the file structure should be the following: +
$ sudo ls -1 /etc/pam.d/{password,system}-auth*
+
+    /etc/pam.d/password-auth
+    /etc/pam.d/password-auth-ac
+    /etc/pam.d/password-auth-local
+    /etc/pam.d/system-auth
+    /etc/pam.d/system-auth-ac
+    /etc/pam.d/system-auth-local
+ diff --git a/linux_os/guide/system/auditing/authconfig_config_files_symlinks/tests/correct_set-up.pass.sh b/linux_os/guide/system/auditing/authconfig_config_files_symlinks/tests/correct_set-up.pass.sh new file mode 100644 index 00000000000..ec75bf6d2d4 --- /dev/null +++ b/linux_os/guide/system/auditing/authconfig_config_files_symlinks/tests/correct_set-up.pass.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# platform = multi_platform_ol,multi_platform_rhel +# remediation = none + +mv /etc/pam.d/system-auth /etc/pam.d/system-auth-ac +mv /etc/pam.d/password-auth /etc/pam.d/password-auth-ac + +cat << EOF > /etc/pam.d/system-auth-local +auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 +auth include system-auth-ac +auth sufficient pam_unix.so try_first_pass +auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 + +account required pam_faillock.so +account include system-auth-ac + +password requisite pam_pwhistory.so use_authtok remember=5 retry=3 +password include system-auth-ac +password sufficient pam_unix.so sha512 shadow try_first_pass use_authtok + +session include system-auth-ac +EOF + +cat << EOF > /etc/pam.d/password-auth-local +auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 +auth include password-auth-ac +auth sufficient pam_unix.so try_first_pass +auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 + +account required pam_faillock.so +account include password-auth-ac + +password requisite pam_pwhistory.so use_authtok remember=5 retry=3 +password include password-auth-ac +password sufficient pam_unix.so sha512 shadow try_first_pass use_authtok + +session include password-auth-ac +EOF + +ln -sf /etc/pam.d/system-auth-local /etc/pam.d/system-auth +ln -sf /etc/pam.d/password-auth-local /etc/pam.d/password-auth diff --git a/linux_os/guide/system/auditing/authconfig_config_files_symlinks/tests/no_symlinks.fail.sh b/linux_os/guide/system/auditing/authconfig_config_files_symlinks/tests/no_symlinks.fail.sh new file mode 100644 index 00000000000..a545d979122 --- /dev/null +++ b/linux_os/guide/system/auditing/authconfig_config_files_symlinks/tests/no_symlinks.fail.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# platform = multi_platform_ol,multi_platform_rhel +# remediation = none + +touch /etc/pam.d/{password,system}-auth-{mycustomconfig,ac} diff --git a/linux_os/guide/system/auditing/authconfig_config_files_symlinks/tests/symlinks_wrong_target.fail.sh b/linux_os/guide/system/auditing/authconfig_config_files_symlinks/tests/symlinks_wrong_target.fail.sh new file mode 100644 index 00000000000..82fb5d543e9 --- /dev/null +++ b/linux_os/guide/system/auditing/authconfig_config_files_symlinks/tests/symlinks_wrong_target.fail.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# platform = multi_platform_ol,multi_platform_rhel +# remediation = none + +mv /etc/pam.d/system-auth /etc/pam.d/system-auth-ac +mv /etc/pam.d/password-auth /etc/pam.d/password-auth-ac + +cat << EOF > /etc/pam.d/system-auth-mycustomconfig +auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 +auth include system-auth-ac +auth sufficient pam_unix.so try_first_pass +auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 + +account required pam_faillock.so +account include system-auth-ac + +password requisite pam_pwhistory.so use_authtok remember=5 retry=3 +password include system-auth-ac +password sufficient pam_unix.so sha512 shadow try_first_pass use_authtok + +session include system-auth-ac +EOF + +cat << EOF > /etc/pam.d/password-auth-mycustomconfig +auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 +auth include password-auth-ac +auth sufficient pam_unix.so try_first_pass +auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 + +account required pam_faillock.so +account include password-auth-ac + +password requisite pam_pwhistory.so use_authtok remember=5 retry=3 +password include password-auth-ac +password sufficient pam_unix.so sha512 shadow try_first_pass use_authtok + +session include password-auth-ac +EOF + +ln -sf /etc/pam.d/system-auth-mycustomconfig /etc/pam.d/system-auth +ln -sf /etc/pam.d/password-auth-mycustomconfig /etc/pam.d/password-auth diff --git a/products/ol7/profiles/stig.profile b/products/ol7/profiles/stig.profile index 5f01204850f..fbb7e203f75 100644 --- a/products/ol7/profiles/stig.profile +++ b/products/ol7/profiles/stig.profile @@ -335,3 +335,4 @@ selections: - account_emergency_expire_date - package_screen_installed - sysctl_kernel_dmesg_restric + - authconfig_config_files_symlinks diff --git a/products/rhel7/profiles/stig.profile b/products/rhel7/profiles/stig.profile index dba166b43fe..7e8af97387d 100644 --- a/products/rhel7/profiles/stig.profile +++ b/products/rhel7/profiles/stig.profile @@ -344,3 +344,4 @@ selections: - package_screen_installed - sysctl_kernel_dmesg_restrict - aide_build_database + - authconfig_config_files_symlinks diff --git a/shared/references/cce-redhat-avail.txt b/shared/references/cce-redhat-avail.txt index b12b80d73a7..51a8412982b 100644 --- a/shared/references/cce-redhat-avail.txt +++ b/shared/references/cce-redhat-avail.txt @@ -1,8 +1,3 @@ -CCE-86035-3 -CCE-86036-1 -CCE-86037-9 -CCE-86039-5 -CCE-86062-7 CCE-86063-5 CCE-86064-3 CCE-86065-0